Skip to contents

Calculate and assign flags based on vaccine history

Usage

cg_annotate_vaccines_count(
  cg,
  vaccine_date_stem = NULL,
  dose = dose,
  dose_counter = NULL,
  intermediate_days = 14
)

Arguments

cg

a chronogram

vaccine_date_stem

the start of the vaccine date columns. Default is NULL. Try "date_dose"; asssumes "date_dose_1,2,3..."

dose

a character vector to use to label the dose column. This is the numerical dose, filled only on the date of that dose (and empty on intervening days). Default is "dose".

dose_counter

column to return the cumulative number of doses. Default is NULL. Try "dose_number"

intermediate_days

number of days to pad after dose date to return as eg "1star" if within intermediate days after dose 1, numeric

Value

An annotated chronogram (class cg_tbl).

Examples

data("built_smallstudy")
cg <- built_smallstudy$chronogram

## annotate vaccines ##
cg <- cg_annotate_vaccines_count(cg,
  dose = dose,
  dose_counter = dose_number,
  vaccine_date_stem = date_dose,
  intermediate_days = 7
)
#> Using stem: date_dose
#> Found vaccine dates
#> date_dose_1
#> 
#> date_dose_2