[R] Changing order of facet grid in ggplot2

From: Christopher Desjardins <cddesjardins_at_gmail.com>
Date: Wed, 18 May 2011 09:14:25 -0500


Hi I am running the following code:

   sym <- c(sym1,sym2,sym4)

lifedxm <- c("O-BD","O-WELL","O-UNI")

life <- c(lifedxm,lifedxm,lifedxm)

tp <- c("TP-ANY","TP-ANY", "TP-ANY", "TP-SUB", "TP-SUB", "TP-SUB", "TP-CLIN" , "TP-CLIN", "TP-CLIN") data <- data.frame(sym,life,tp)

qplot(life,geom="bar",weight=sym,ylim=c(0,1),legend=F,data=data) + facet_grid(. ~ tp)

This creates a facet grid where TP-ANY is followed by TP-CLIN and then TP-SUB. I'd like to create a grid where TP-ANY is followed by TP-SUB then TP-CLIN. Is this possible?

Thanks,

Chris

        [[alternative HTML version deleted]]



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 Wed 18 May 2011 - 14:16:16 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

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 Wed 18 May 2011 - 15:10:07 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