[R] boxplot help

John Kane jrkrideau at inbox.com
Wed Aug 15 15:22:32 CEST 2012


Hi Andy,

Nice plot but yes, probably not exactly what you want.  

Thanks for providing the code.  The nextthing you need to do is to send us some data to go with the code.  There is a very handy function called dput() , which converts a dataset into a format that you can just copy from your R terminal and paste into an email that allows readers to work wiith your data or a sample of it.

If the dataset is really large then something like dput(head (mydata, 50))  will supply the first fifty rows of data for us to work with.

One of your problems seems to be that your dates are character values and need to be converted into datesfor you to get the chronological date order.  See ?strptime  or perhaps install the lubridate package for help there.

Otherwise welcome to R 

Note to other readers : I think I actually got the dput syntax this time!!

John Kane
Kingston ON Canada


> -----Original Message-----
> From: freakyspeaky at hotmail.com
> Sent: Wed, 15 Aug 2012 05:34:55 -0700 (PDT)
> To: r-help at r-project.org
> Subject: [R] boxplot help
> 
> Hi, im a newbie with very wobbly coding abilities.
> Tearing my hair out over getting the boxplot i want...
> 
> I have a dataset called 'eagle' which consists of year (2011 or 2012),
> month
> (jan - dec), roof (TT6, TT13 or BARE) and temp (the continuous variable
> that
> i want to plot).
> So i want boxplots of the three roof treatments in every month organised
> in
> chronical order along x axis 2011 - 2012.
> 
> my code at the moment is:
> 
>> boxplot(Temp~Month, data=eagle, at = 1:12 - 0.5, boxwex=0.25,
>> subset=Roof
>> == "TT6", col = "green")
>> boxplot(Temp~Month, data=eagle, add=TRUE, at = 1:12 - 0.1, boxwex =
>> 0.25,
>> subset=Roof == "TT13", col = "darkgreen")
>> boxplot(Temp~Month, data=eagle, add=TRUE, boxwex=0.25, at = 1:12 + 0.2,
>> subset=Roof == "BARE", col = "red")
>> smartlegend(x="left",y="top", inset = 0, c("green 1", "green 2",
>> "bare"),
>> fill = c("green", "darkgreen", "red"))
> 
> which produces the graph inserted
> 
> Can anyone point me in right direction?
> thanks  http://r.789695.n4.nabble.com/file/n4640360/boxplot_trial.jpg
> 
> 
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/boxplot-help-tp4640360.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.

____________________________________________________________
GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys
Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails



More information about the R-help mailing list