[R] Plotting using tapply function output
John Kane
jrkrideau at inbox.com
Tue Mar 31 15:48:51 CEST 2015
Reproducibility
https://github.com/hadley/devtools/wiki/Reproducibility
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
John Kane
Kingston ON Canada
> -----Original Message-----
> From: amc5981 at gmail.com
> Sent: Mon, 30 Mar 2015 16:07:05 -0700
> To: r-help at r-project.org
> Subject: [R] Plotting using tapply function output
>
> Hello,
>
> I am trying to plot the hourly standard deviation of wind speeds from
> 13 different measured locations over many years. I imported the data
> using readLines and into a dataframe called finalData. Using tapply, I
> determined the standard deviation of the windspeed (ws) for each hour
> (hour) from every location (stn) using this command line:
>
> statHour = tapply(finalData$ws,list(finalData$stn,finalData$hour),sd)
>
> I want to plot the standard deviation for each hour of the day, with
> hours as the x-axis and the standard deviation for the y-axis, and
> each station as a different color. I've managed to get a boxplot of
> this, but ideally, I'd like a scatter plot to determine the variations
> between each instrument throughout the day. The boxplot command is
> this:
>
> boxplot(statHour, names=colnames(statHour),xlab='Hour of the
> Day',ylab='Standard Deviation of Wind Speed')
>
> I also tried to make a dataframe of the tapply output but it ends up
> using the hours as the column names instead of putting it into the
> dataframe. Please help!!
>
> I have R version 3.1.1
>
> Thanks a lot,
> Alexandra
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!
More information about the R-help
mailing list