Chris, You can use the as.is or stringsAsFactors argument in read.csv to prevent that strings are converted into factors. See ?read.csv for the details.
Thierry ------------------------------------------------------------------------ ---- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 [EMAIL PROTECTED] www.inbo.be Do not put your faith in what statistics say until you have carefully considered what they do not say. ~William W. Watt A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney -----Oorspronkelijk bericht----- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Chris Friedl Verzonden: woensdag 27 februari 2008 11:23 Aan: r-help@r-project.org Onderwerp: Re: [R] how to specify ggplot2 facet plot order Hi Thierry thanks for your help. I've been searching the R-help archives for posts by you and Hadley as a way to learn ggplot details so I appreciate your help to the R community. I wasn't aware of the levels option in the factors function. In my real application I get the data using read.csv and factor assignment happens automagically. Is there a way to control the level assignments at the input stage? Can't see anything to that effect in help. Sorry for the cut & paste error ... getting used to Xemacs on Windows. I used emacs years ago on Unix but now my environment is Windows. So far I find the Xemacs/Ess combo to be very powerful and flexible. Just need to get used to C-x C-c etc differences. ONKELINX, Thierry wrote: > > Chris, > > The order of the facets row or column depend on the order in the > associated factor. The code below is what you want. Note that I have > changed 'cases' in 'series' because your example was not reproducible as > a definition of 'cases' was missing. > > library(ggplot2) > series <- c('C2','C4','C8','C10','C15','C20') > series <- factor(series, levels = series) > ids <- c('ID1','ID2','ID3') > mydata <- > data.frame(SERIES=rep(series,30),ID=rep(ids,60),VALUE=rnorm(180)) > qplot(VALUE, data = mydata, geom="density", facets=SERIES ~ ID) > > Thierry > -- View this message in context: http://www.nabble.com/how-to-specify-ggplot2-facet-plot-order-tp15705404 p15710275.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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. ______________________________________________ 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.