[R] Re-ordering the order of lattice graphics panels

John Fox jfox at mcmaster.ca
Wed Sep 25 14:30:08 CEST 2002


Dear Albertus,

At 11:31 AM 9/25/2002 +0200, Smit, A, Albertus, Dr wrote:

>I have made some lattice graphs (bwplot(dead ~ treat | group,...).
>'group' is a factor with three levels (Artemia larvae, Abalone larvae
>and Abalone spat), and the result is a graph with three panels
>corresponding to the levels in 'group', ordered in alphabetical order
>from bottom to top, as expected.
>
>How does one re-order the order in which the levels of 'group' in the
>graph? I want Abalone spat at the bottom, followed by Abalone larvae,
>and Artemia larvae at the top. I have read most of the help on
>bwplots, panel.functions etc., but I am sure there is something
>obvious and simple I have missed.

You can specify the order of the levels of a factor using the levels 
argument to factor(); the default, as you mention, is to order the levels 
alphabetically. To change the order, group.2 <- factor(group, c("Abalone 
spat", "Abalone larvae", "Abalone spat")).

This should give you what you want.
   John
-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list