[R] reorder() in the latticeExtra library

2012-11-03 Thread JDINIS
Hello all, thanks for your time and help. Below are my commands, and it
generates a really nice plot, however I am not happy with the reorder()
function. I would like the order to be the same as they appear in the
genotype variable  genotype - c(CJ1450 NW 4/25/12,CJ1450 BAL
4/25/12,CJ1450 NW 4/27/12,CJ1450 BAL 4/27/12,CJ1721 NW
4/27/12,CJ1721 BAL 4/27/12,CJ1721 NW 4/29/12,CJ1721 BAL 4/29/12 )
and not as it is currently coded.

Is there any way to turn off the reorder, or set it up so the values appear
in the order above, thank you again!

(I am open to all suggestions)

JD


genotype - c(CJ1450 NW 4/25/12,CJ1450 BAL 4/25/12,CJ1450 NW
4/27/12,CJ1450 BAL 4/27/12,CJ1721 NW 4/27/12,CJ1721 BAL
4/27/12,CJ1721 NW 4/29/12,CJ1721 BAL 4/29/12 )
#paste(Animal, as.roman(1:8), sep = -) 
plant.height - c(0.001173003, 0.001506127, 0.001361596, 0.001922572,
0.034272147, 0.030466017, 0.001654299, 0.001071724)
SE - c(0.000444123, 0.000290096, 0.000372844, 0.00197687, 0.033945128,
0.035231568, 0.001094518, 0.000423545) 
lower - plant.height - SE; upper - plant.height + SE 
x - data.frame(group = genotype, lower = lower, est = plant.height, upper =
upper)

library(latticeExtra) 
segplot(reorder(genotype, est) ~ lower + upper, data = x, draw.bands =
FALSE, centers = est, segments.fun = panel.arrows, ends = both, angle =
90, length = 0, par.settings = simpleTheme(pch = 19, col = 1), xlab =
expression(nucleotide diversity  %+-%  sd), panel = function(x, y, z,
...) { 
panel.abline(h = z, col = grey, lty = dashed) 
panel.abline(v = 14.20, col = grey) 
panel.segplot(x, y, z, ...)}) 



--
View this message in context: 
http://r.789695.n4.nabble.com/reorder-in-the-latticeExtra-library-tp4648299.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] reorder() in the latticeExtra library

2012-11-03 Thread David Winsemius

On Nov 2, 2012, at 8:04 PM, JDINIS wrote:

 Hello all, thanks for your time and help. Below are my commands, and it
 generates a really nice plot, however I am not happy with the reorder()
 function. I would like the order to be the same as they appear in the
 genotype variable  genotype - c(CJ1450 NW 4/25/12,CJ1450 BAL
 4/25/12,CJ1450 NW 4/27/12,CJ1450 BAL 4/27/12,CJ1721 NW
 4/27/12,CJ1721 BAL 4/27/12,CJ1721 NW 4/29/12,CJ1721 BAL 4/29/12 )
 and not as it is currently coded.
 
 Is there any way to turn off the reorder, or set it up so the values appear
 in the order above, thank you again!
 
 (I am open to all suggestions)
 
 JD
 
 
 genotype - c(CJ1450 NW 4/25/12,CJ1450 BAL 4/25/12,CJ1450 NW
 4/27/12,CJ1450 BAL 4/27/12,CJ1721 NW 4/27/12,CJ1721 BAL
 4/27/12,CJ1721 NW 4/29/12,CJ1721 BAL 4/29/12 )
 #paste(Animal, as.roman(1:8), sep = -) 
 plant.height - c(0.001173003, 0.001506127, 0.001361596, 0.001922572,
 0.034272147, 0.030466017, 0.001654299, 0.001071724)
 SE - c(0.000444123, 0.000290096, 0.000372844, 0.00197687, 0.033945128,
 0.035231568, 0.001094518, 0.000423545) 
 lower - plant.height - SE; upper - plant.height + SE 
 x - data.frame(group = genotype, lower = lower, est = plant.height, upper =
 upper)
 
 library(latticeExtra) 
 segplot(reorder(genotype, est) ~ lower + upper, data = x, draw.bands =
 FALSE, centers = est, segments.fun = panel.arrows, ends = both, angle =
 90, length = 0, par.settings = simpleTheme(pch = 19, col = 1), xlab =
 expression(nucleotide diversity  %+-%  sd), panel = function(x, y, z,
 ...) { 
 panel.abline(h = z, col = grey, lty = dashed) 
 panel.abline(v = 14.20, col = grey) 
 panel.segplot(x, y, z, ...)}) 

Wouldn't you just define genotype as a factor with the desired sequence of 
levels and remove the call to reorder?

-- 
David Winsemius, MD
Alameda, CA, USA

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] reorder() in the latticeExtra library

2012-11-03 Thread Jorge Dinis
Thanks David, I used you suggestion and it worked fine, please see below for 
what I did.

segplot(reorder(factor(genotype), genotype) ~ lower + upper


On Nov 3, 2012, at 2:47 AM, David Winsemius wrote:

 define genotype as a factor


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] reorder() in the latticeExtra library

2012-11-03 Thread David Winsemius

On Nov 3, 2012, at 6:36 AM, Jorge Dinis wrote:

 Thanks David, I used you suggestion and it worked fine, please see below for 
 what I did.
 
 segplot(reorder(factor(genotype), genotype) ~ lower + upper
Perhaps a missing close-paren . ^
Although reading this as a formatted posting such as you sent might cause a 
registration error.

 
 
 On Nov 3, 2012, at 2:47 AM, David Winsemius wrote:
 
 define genotype as a factor
 
-- 
David Winsemius, MD
Alameda, CA, USA

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] reorder() in the latticeExtra library

2012-11-03 Thread arun
Hi,
Try this:
genotype1-factor(genotype,levels=c(CJ1450 NW 4/25/12,CJ1450 BAL 4/25/12, 
CJ1450 NW\n4/27/12, 
CJ1450 BAL 4/27/12, CJ1721 NW 4/27/12, CJ1721 BAL\n4/27/12,
CJ1721 NW 4/29/12, CJ1721 BAL 4/29/12) )

segplot(genotype1 ~ lower + upper, data = x, draw.bands =
FALSE, centers = est, segments.fun = panel.arrows, ends = both, angle =
90, length = 0, par.settings = simpleTheme(pch = 19, col = 1), xlab =
expression(nucleotide diversity  %+-%  sd), panel = function(x, y, z,
...) {
panel.abline(h = z, col = grey, lty = dashed)
panel.abline(v = 14.20, col = grey)
panel.segplot(x, y, z, ...)}) 
A.K.





- Original Message -
From: JDINIS jorgemdi...@gmail.com
To: r-help@r-project.org
Cc: 
Sent: Friday, November 2, 2012 11:04 PM
Subject: [R] reorder()  in the latticeExtra library

Hello all, thanks for your time and help. Below are my commands, and it
generates a really nice plot, however I am not happy with the reorder()
function. I would like the order to be the same as they appear in the
genotype variable  genotype - c(CJ1450 NW 4/25/12,CJ1450 BAL
4/25/12,CJ1450 NW 4/27/12,CJ1450 BAL 4/27/12,CJ1721 NW
4/27/12,CJ1721 BAL 4/27/12,CJ1721 NW 4/29/12,CJ1721 BAL 4/29/12 )
and not as it is currently coded.

Is there any way to turn off the reorder, or set it up so the values appear
in the order above, thank you again!

(I am open to all suggestions)

JD


genotype - c(CJ1450 NW 4/25/12,CJ1450 BAL 4/25/12,CJ1450 NW
4/27/12,CJ1450 BAL 4/27/12,CJ1721 NW 4/27/12,CJ1721 BAL
4/27/12,CJ1721 NW 4/29/12,CJ1721 BAL 4/29/12 )
#paste(Animal, as.roman(1:8), sep = -) 
plant.height - c(0.001173003, 0.001506127, 0.001361596, 0.001922572,
0.034272147, 0.030466017, 0.001654299, 0.001071724)
SE - c(0.000444123, 0.000290096, 0.000372844, 0.00197687, 0.033945128,
0.035231568, 0.001094518, 0.000423545) 
lower - plant.height - SE; upper - plant.height + SE 
x - data.frame(group = genotype, lower = lower, est = plant.height, upper =
upper)

library(latticeExtra) 
segplot(reorder(genotype, est) ~ lower + upper, data = x, draw.bands =
FALSE, centers = est, segments.fun = panel.arrows, ends = both, angle =
90, length = 0, par.settings = simpleTheme(pch = 19, col = 1), xlab =
expression(nucleotide diversity  %+-%  sd), panel = function(x, y, z,
...) { 
panel.abline(h = z, col = grey, lty = dashed) 
panel.abline(v = 14.20, col = grey) 
panel.segplot(x, y, z, ...)}) 



--
View this message in context: 
http://r.789695.n4.nabble.com/reorder-in-the-latticeExtra-library-tp4648299.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.