0

I have some time series data (18841 obs, 3 variables) which i have imported into R and have made it a time series object using xts. see the code below

library(ggplot2)
library(tseries)
require(zoo)
require(xts)
dates=seq(as.Date("1960/06/1"), as.Date("2011/12/31"), "days")
mytimeseries1 = xts(mydataset, order.by = dates)

Now mytimeseries1 is an xts object having variables var1, var2 and var3. I want to have boxplot of these variables in groups of months or years (any of them). Kindly help with R code to generate boxplots.

I have tried this:

boxplot(var1~months,data=mytimeseries1, xlab="Months", ylab="First variable", main="Box plot of variable 1")

boxplot(var1~dates$months,data=mytimeseries1, xlab="Months", ylab="First variable", main="Box plot of variable 1")

But to no success, Kindly help.

0 Answers0