Learn R Programming

RCMIP5 (version 1.2.0)

makeMonthlyStat: Compute monthly statistic of a variable

Description

We frequently want to summarize CMIP5 data by month, e.g. to understand how air temperature varies over the year for a particular data range. This function does that for monthly data. The default statistic is mean, but any summary function that returns a numeric result can be used.

Usage

makeMonthlyStat(x, verbose = FALSE, sortData = FALSE, FUN = mean, ...)

Arguments

x
A cmip5data object
verbose
logical. Print info as we go?
sortData
logical. Sort x and area before computing?
FUN
function. Function to apply across months of year
...
Other arguments passed on to FUN

Value

A cmip5data object, whose val field is the monthly mean of the variable. A numYears field is also added recording the number of years averaged for each month.

Details

The stat function is calculated for all combinations of lon, lat, and Z (if present).

See Also

makeAnnualStat makeZStat makeGlobalStat

Examples

Run this code
d <- cmip5data(1970:1975)   # sample data
makeMonthlyStat(d)
summary(makeMonthlyStat(d))
summary(makeMonthlyStat(d, FUN=sd))

Run the code above in your browser using DataLab