[R] Facets in ggplot2

2010-10-01 Thread Prew, Paul

Hello,  

I'm trying to introduce myself to ggplot2.  I'm using syntax from the help 
file, but pasting in my own data.  I don't understand the error message I'm 
getting.  Can anyone clue me in?  A Google search of this error statement 
didn't return anything I could recognize as useful.

Thanks, Paul


 str(d.AD)
'data.frame':  9 obs. of  3 variables:
 $ treatment: Factor w/ 3 levels 1,2,3: 1 1 1 2 2 2 3 3 3
 $ outcome  : Factor w/ 3 levels 1,2,3: 1 2 3 1 2 3 1 2 3
 $ counts   : num  18 17 15 20 10 20 25 13 12


qplot(d.AD$outcome,d.AD$counts,data=d.AD, facets=.~ d.AD$treatment)

Error in `[.data.frame`(plot$data, , setdiff(cond, names(df)), drop = FALSE) : 
  undefined columns selected


Paul Prew   ▪  Statistician
651-795-5942   ▪   fax 651-204-7504 
Ecolab Research Center   ▪  Mail Stop ESC-F4412-A 
655 Lone Oak Drive   ▪   Eagan, MN 55121-1560 



CONFIDENTIALITY NOTICE: 
This e-mail communication and any attachments may contain proprietary and 
privileged information for the use of the designated recipients named above. 
Any unauthorized review, use, disclosure or distribution is prohibited. 
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message.


[[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] Facets in ggplot2

2010-10-01 Thread baptiste auguie
Try this,

qplot(outcome, counts, data=d.AD, facets=.~ treatment)

HTH,

baptiste

__
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.