[R] Plotting using tapply function output
Alexandra Catena
amc5981 at gmail.com
Tue Mar 31 01:07:05 CEST 2015
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
More information about the R-help
mailing list