Learn R Programming

LTASR (version 0.1.4)

smr_major: Calculate SMRs for Major groupings

Description

smr_major will collapse minor outcomes into "major" groupings as defined in the rate object, rateobj.

Usage

smr_major(smr_minor_table, rateobj)

Value

A data.frame/tibble containing the expected and observed number of deaths as well as SMRs, lower CI and upper CI for each major as defined in the rate object rateobj

Arguments

smr_minor_table

A data.frame/tibble as created by smr_minor containing observed and expected number of deaths for each minor outcome

rateobj

A rate object created by parseRate, or the included rate object us_119ucod_19602021.

Examples

Run this code
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)

#Calculate SMRs for all minors
smr_minor_table <- smr_minor(py_table, rateobj)

#Calculate SMRs major groupings found within rate file
smr_major(smr_minor_table, rateobj)

Run the code above in your browser using DataLab