Learn R Programming

rts (version 1.1-14)

apply.monthly: Apply a function over calendar periods

Description

Apply a specified function to each distinct period in a given raster time series object.

Usage

apply.daily(x, FUN, ...)
apply.weekly(x, FUN, ...)
apply.monthly(x, FUN, ...)
apply.quarterly(x, FUN, ...)
apply.yearly(x, FUN, ...)

Value

A raster time series (Raster*TS) object

Arguments

x

a raster time series (Raster*TS) object, created by rts

FUN

an R function

...

additional arguments to FUN

Details

These functions offer Simple mechanism to apply a function to non-overlapping time periods, e.g. weekly, monthly, etc, and return a raster time series object including a raster layer for each period in the original data, produced by FUN. The end of each period of time is assigned to the corresponding raster layer in the output.

See Also

endpoints, period.apply,

Examples

Run this code
if (FALSE) {
file <- system.file("external/ndvi", package="rts")

ndvi <- rts(file) # read the ndvi time series from the specified file
ndvi
ndvi.y <- apply.yearly(ndvi, mean) # apply mean function for each year
ndvi.y
ndvi.q <- apply.quarterly(ndvi,sd) # apply sd function for each quarter of years
ndvi.q 
}

Run the code above in your browser using DataLab