[R] xyplot() - can you control how the plots are ordered?

From: AR <anandram_at_gmail.com>
Date: Sat, 07 Mar 2009 22:05:24 -0800 (PST)


Hi,

I want to control the plots in the output of the xyplot(). It is easier to explain it through an example:

#-------------------------------------------------------------
library(lattice);
# months
months <- c("Jan", "Feb", "Mar",

"Apr", "May", "Jun",
"Jul", "Aug", "Sep",
"Oct", "Nov", "Dec");

n <- length(months);
m <- 10;

mdata <- data.frame(x = runif(m*n), y = runif(m*n), z = rep(months, each = m));
h <- xyplot(y ~ x | z, data = mdata);
plot(h);

#-------------------------------------------------------------

The output of the xyplot() is sorted by the alphabetical order of months (First Apr, then Aug so on). I need to output such that the order of the months is maintained, i.e. plot of Jan first, then Feb, Mar ... so on.

I tried searching on the web and I couldn't find any or probably didn't understand. I would be much obliged if someone could help.

Thanks
Anand.



R-help_at_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. Received on Sun 08 Mar 2009 - 07:17:36 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 08 Mar 2009 - 09:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive