Description Usage Arguments Details Value Author(s) See Also Examples
This function allows for the aggregation of non-continuos time series data into months. It allows for the multiple months to be specified. The aggregation method is also allowed to be set by the user.
1 |
data |
A |
process |
An aggregation method. See |
multiple |
An integer specifying the aggregation block. Default is multiple=NULL. |
na.rm |
Default is na.rm=FALSE |
This function is based on the aggregate
method. It is designed to simplify the process of aggregating non-continuos data.
Returns a data.frame with dates formatted as as.POSIXlt
and aggregated data.
Jason Lessels <jason.lessels@sydney.edu.au>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ##Load the data
data(foo)
##Format the data using the timeSeries function.
foo.ts <- timeSeries(foo[,1],"%d/%m/%Y %H:%M",foo[,3])
##Aggregate the data into 6 month blocks using mins
min.month <- monthsAgg(foo.ts,min,6)
##Aggregate the data into 6 days blocks using max
max.month <- monthsAgg(foo.ts,max,6)
##Aggregate the data into 6 days blocks using max
mean.month <- monthsAgg(foo.ts,mean,6)
#Create a plot of the results
ymin=min(min.month$data);ymax=max(max.month$data)
plot(mean.month,ylim=c(ymin,ymax))
lines(min.month,type="l",lty=3,col="red")
lines(max.month,type="l",lty=3,col="blue")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.