monthmean: Monthly means

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/monthmean.R

Description

Calculate the monthly mean or adjusted monthly mean for count data.

Usage

1
monthmean(data, resp, pop=NULL, adjmonth=FALSE)

Arguments

data

data set as a data frame.

resp

response variable in the data set for which the means will be calculated.

pop

optional population, used as an offset (default=NULL).

adjmonth

adjust monthly counts and scale to a 30 day month (‘thirty’) or the average month length (‘average’) (default=FALSE).

Details

For time series recorded at monthly intervals it is often useful to examine (and plot) the average in each month. When using count data we should adjust the mean to account for the unequal number of days in the month (e.g., 31 in January and 28 or 29 in February).

This function assumes that the data set (data) contains variables for the year and month called year and month, respectively.

Value

Returns an object of class “Monthmean” with the following parts:

mean

a vector of length 12 with the monthly means.

Author(s)

Adrian Barnett a.barnett<at>qut.edu.au

References

Barnett, A.G., Dobson, A.J. (2010) Analysing Seasonal Health Data. Springer.

See Also

plot.Monthmean

Examples

1
2
3
4
5
# cardiovascular disease data
data(CVD)
mmean = monthmean(data=CVD, resp=cvd, adjmonth='average')
mmean
plot(mmean)

season documentation built on May 2, 2019, 5:22 p.m.