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 parseRate function, or the included rate object us_119ucod_19602021

strata

any additional variables contained in persondf on which to stratify. Must be wrapped in a vars() call from dplyr.

batch_size

a number specifying how many persons to stratify at a time. Default is 500

Details

The persondf tibble must contain the variables:

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)


[Package LTASR version 0.1.3 Index]