Learn R Programming

surveillance (version 1.23.1)

tidy.sts: Convert an "sts" Object to a Data Frame in Long (Tidy) Format

Description

The resulting data frame will have a row for each time point and observational unit, and columns corresponding to the slots of the "sts" object (except for populationFrac, which is named population). Some time variables are added for convenience: year, epochInYear, epochInPeriod, date (the latter gives NA dates if epoch(x, as.Date=TRUE) fails, i.e., for non-standard x@freq if not x@epochAsDate).

Usage

tidy.sts(x, ...)

Arguments

x

an object of class "sts".

...

unused.

Author

Sebastian Meyer

See Also

as.data.frame.sts

Examples

Run this code
data("momo")
momodat <- tidy.sts(momo)
head(momodat)

## tidy.sts(stsObj) is the same as as.data.frame(stsObj, tidy = TRUE)
stopifnot(identical(as.data.frame(momo, tidy = TRUE), momodat))

Run the code above in your browser using DataLab