Wrapper for construct_cohort_followup() and summarise_cohort_followup() which avoids memory issues by constructing follow-up data summaries in strata

summarise_cohort_vac_outcome(
  cohort_vac_outcome,
  by = NULL,
  split_by = NULL,
  n = NULL,
  verbose = FALSE,
  ...
)

Arguments

cohort_vac_outcome

Data returned by construct_cohort_vac_outcome()

by

columns in cohort_followup to aggregate the data by. It should be noted that in the followup data and therefore in aggregated results, column names are in UPPERCASE and "." are replaced with "_".

split_by

An optional character vector which defines a column in the input data by which to split up the computation for memory efficiency. For example "SUKUPUOLI" performs the computations in two roughly even chunks. Alternatively, an numeric integer giving the number of splits to use, e.g. 5.

n

An integer of length one. An optional integer for choosing a random sample of n individuals from the input data. This is useful for testing as the processing can be very slow and memory intensive for a big data set.

verbose

If TRUE, will give messages on which strata (split) is under processing.

...

arguments to construct_cohort_followup

Examples



start_date <- "2020-02-01" # start of follow-up
end_date <- as.character(Sys.Date()) # end of follow-up

cohort <-  data.frame(HETU_ID = c(1,2), 
SYNTYMAPAIVA = c(as.Date("1982-02-04"), as.Date("1980-05-04")),
KUOLINPVM = c(NA, NA))

vacs <-  data.frame(HETU_ID = c(1,1), 
RECORDDATE = as.Date(c("2021-04-20", "2021-05-20")), 
PRODUCT_ID  = c("COV", "COV"))

outcome <- data.frame(HETU_ID = c(1,1, 2),
TAPAHTUMAPVM = as.Date(c("2021-04-25", "2021-06-25", "2021-04-02")))


cohort_vac_outcome <- construct_cohort_vac_outcome(cohort, vacs, outcome,
incident_cases = FALSE,
washout = 0)

summarise_cohort_vac_outcome(cohort_vac_outcome, by = c("VACCINE_EFFECT"))
#>    VACCINE_EFFECT PERSONDAYS EVENT_COUNT
#>            <char>      <num>       <int>
#> 1:           None       2011           1
#> 2:     VAC1:0-Inf         30           1
#> 3:     VAC2:0-Inf       1751           1