get_table {LTASR} | R Documentation |
Stratify Person Table
Description
get_table
reads in a data.frame/tibble containing basic demographic information
for each person of the cohort and stratifies the person-time and deaths into 5-year age,
5-year calendar period, race, and sex strata. See Details
for information on how the
person file must be formatted.
Usage
get_table(persondf, rateobj, strata = dplyr::vars(), batch_size = 500)
Arguments
persondf |
data.frame like object containing one row per person with the required demographic information |
rateobj |
a rate object created by the |
strata |
any additional variables contained in persondf on which to stratify.
Must be wrapped in a |
batch_size |
a number specifying how many persons to stratify at a time. Default is 500 |
Details
The persondf tibble must contain the variables:
id,
gender (character: 'M'/'F'),
race (character: 'W'/'N'),
dob (date),
pybegin (date),
dlo (date),
rev (numeric: values 5-10),
code (character: ICD code)
Value
A data.frame with a row for each strata containing the number of observed
deaths within each of the defined minors/outcomes (_o1
-_oxxx
) and the number of person days.
Examples
library(LTASR)
library(dplyr)
#Import example person file
person <- person_example %>%
mutate(dob = as.Date(dob, format='%m/%d/%Y'),
pybegin = as.Date(pybegin, format='%m/%d/%Y'),
dlo = as.Date(dlo, format='%m/%d/%Y'))
#Import default rate object
rateobj <- us_119ucod_19602021
#Stratify person table
py_table <- get_table(person, rateobj)