Displaying 2 results from an estimated 2 matches for "alphebetical".
Did you mean:
alphabetical
2009 Sep 30
1
bwplot scales in alphabetical order
Dear List,
I know this has been covered before, but I don't seem to be able to get it right. I am constructing a boxplot in lattice and can't get the scales in the correct alphebetical order. I have already read that this is due to the way factors are treated, and I have to redefine the levels of the factors. However, I have failed.
As a simple example:
library(lattice)
id<-rep(letters[1:9], each=20)
x<-rep(seq(1:10),each=18)
y<-rnorm(180,50,20)
#Reverse alphebetic...
2010 May 06
1
bar order using lattice barchart()
...ataframe in alphebitical order with row numbers in
#numerical order.
> xy
x y
1 a 8.921657
2 b 10.314625
3 c 9.531537
4 d 10.818563
5 e 9.084872
#If I re-order the data based on the value of y
xy<-xy[order(y),]
#I get a dataframe ordered by y but the row numbers are still in #alphebetical order based on x
> xy
x y
1 a 8.921657
5 e 9.084872
3 c 9.531537
2 b 10.314625
4 d 10.818563
#I then try to plot the data and it plots it in alphabetical instead of
#numeric order
library(lattice)
barchart(y~x, data=xy)
Why are the rows not re-indexed, and how do I get barchart(...