Skip to contents

Decorate a chronogram skeleton with metadata to return a chronogram. For most circumstances, cg_assemble() is suggested (which calls chronogram_skeleton() and chronogram()). See assembly vignette.

Usage

chronogram(cg_skeleton, metadata)

Arguments

cg_skeleton

a cg_skeleton, generated by chronogram_skeleton()

metadata

a tibble containing metadata and ID column name (and IDs) that are present in cg_skeleton

Value

An object of chronogram class, with metadata spread across all calendar_dates.

Examples

## a 3-person chronogram_skeleton ##-------------------------------

small_study <- chronogram_skeleton(
  col_ids = elig_study_id,
  ids = c(1, 2, 3),
  start_date = "01012020",
  end_date = "10102021",
  col_calendar_date = calendar_date
)

## A tibble containing some metadata for our 3 individuals ##
data(smallstudy)
small_study_metadata <- smallstudy$small_study_metadata
small_study_metadata
#> # A tibble: 3 × 7
#>   elig_study_id   age sex   dose_1   date_dose_1 dose_2   date_dose_2
#>           <dbl> <dbl> <fct> <fct>    <date>      <fct>    <date>     
#> 1             1    40 F     AZD1222  2021-01-05  AZD1222  2021-02-05 
#> 2             2    45 F     BNT162b2 2021-01-05  BNT162b2 2021-02-05 
#> 3             3    35 M     BNT162b2 2021-01-10  BNT162b2 2021-03-10 

## Make a chronogram ##
small_study_chronogram <- chronogram(
  small_study,
  small_study_metadata
)