[R] Using boxplot in a daily time series

Domenico Vistocco vistocco at unicas.it
Sat Dec 15 22:56:04 CET 2007


 From your post it is not clear how the data are organized. Supposing 
they are in a data frame you could use the ~ sintax.

For example:
timeColumn=as.Date("01-01-1970") + 1:500
timeSeries=rnorm(500)
df=data.frame(time=timeColumn, index=timeSeries)
> > head(df)
>      time      index
> 1 1-01-20 -0.6382554
> 2 1-01-21 -2.0346649
> 3 1-01-22 -0.4900213
> 4 1-01-23  0.7311806
> 5 1-01-24  0.9386528
> 6 1-01-25  0.7868129
boxplot(index~months(time), data=df)

Perhaps you would order the 12 boxes according to the months:
monthColumn=ordered(months(df$time), levels= c("January", "February", 
"March",
            "April", "May", "June", "July", "August", "September", 
"October", "November", "December"))
boxplot(df$index~monthColumn)

domenico

pedrosmarques at portugalmail.pt wrote:
> Hi all, 
>
> I'm trying to plot my daily time series, with 3650 observations( 10 years), with boxplot but I want 12 boxes, one for each month, can anyone help me doing that.
>
> Best regards
>
> ______________________________________________
> 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.
>
>



More information about the R-help mailing list