Learn R Programming

popEpi (version 0.3.1)

longDF2ratetable: Experimental: Coerce a long-format data.frame to a ratetable object

Description

Coerces a long-format data.frame of population hazards to an array, and in turn to a ratetable, which can be used in e.g. survival's expected survival computations and relsurv's relative survival computations.

Usage

longDF2ratetable(DF, value.var = "haz", by.vars = setdiff(names(DF), value.var))

Arguments

DF
a data.frame
value.var
name of values variable in quotes
by.vars
names vector of variables by which to create (array) dimensions

See Also

ratetable, as.data.table.ratetable, as.data.frame.ratetable