Hi I am very new to R, I am attempting to produce a monthly boxplot with the following fish thermal telemetry data:
ID Temp Date.Time Month.Year Month Week Shortdate 1 1734 4.4140 04/05/2010 11:56 05,2010 May 19 04/05/2010 2 1734 4.1002 04/05/2010 12:06 05,2010 May 19 04/05/2010 3 1734 3.9433 04/05/2010 12:09 05,2010 May 19 04/05/2010 4 1734 3.6295 04/05/2010 12:29 05,2010 May 19 04/05/2010 5 1734 3.6295 04/05/2010 12:34 05,2010 May 19 04/05/2010 6 1734 3.6295 04/05/2010 12:37 05,2010 May 19 04/05/2010 I constructed my data in access. I have data from May2010 to april 2011 When I use ggplot2 plot6<-ggplot(data=Good,aes(Month.Year,Temp)) > + geom_boxplot() the x axis factor order is jan 2011,feb2011, march 2011, april2011, May 2010etc. I would like the months to be in chronological order I have tried a number of conversions using format and as.date and as.POSIXlt with no luck including Goodyearmonth<-as.Date(Good$Shortdate,format="%Y/%m") and i tried Good$Gmonth<- with(Good,factor(as.POSIXlt(Shortdate)$mon) If I pivot my data by month in access so it looks like this May-10 Jun-10 Jul-10 4.1002 7.3951 8.3365 3.9433 7.3951 8.1796 3.6295 7.3951 8.0227 then a simple boxplot() works however I would like to use the ggplot2 package because eventually I would like to change the whiskers to 95% and 5% quantiles (I think I know how to do this http://r.789695.n4.nabble.com/Custom-Plot-means-SD-amp-5th-95th-Plotmeans-or-Boxplot-td848126.html) Thanks for any help you can provide Philip Harrison PhD Student Fisheries ecology Uwaterloo -- View this message in context: http://r.789695.n4.nabble.com/ggplot2-month-and-year-boxplot-x-axis-order-problem-tp3623029p3623029.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.