Make time relative to first date of the test.
Usage
epict_make_time_rel(obs, baseline_date = min(obs$test_date, na.rm = TRUE))
Arguments
- obs
A
data.frame
with the following variables:test_date
: Date of the test yielding a Ct value.onset_date
: Date of onset for each infection (optional).
- baseline_date
A date to use as the baseline date for all other times in the dataset. By default this is the minimum test date in the dataset.
See also
Preprocessing functions
epict_check_obs()
,
epict_check_raw_obs()
,
epict_clean_factors()
,
epict_drop_na_ct()
,
epict_filter_ids()
,
epict_flag_spurious_obs()
,
epict_make_time_rel_to_first_uncensored()
Examples
obs <- data.frame(test_date = as.Date(c("2022-04-22", "2022-04-19")))
# Using default baseline date
epict_make_time_rel(obs)
#> test_date t
#> 1: 2022-04-22 3
#> 2: 2022-04-19 0
# Using user specified baseline date
epict_make_time_rel(obs, baseline_date = as.Date("2022-04-01"))
#> test_date t
#> 1: 2022-04-22 21
#> 2: 2022-04-19 18
# When onsets are present
obs$onset_date <- obs$test_date
epict_make_time_rel(obs)
#> test_date onset_date t onset_t
#> 1: 2022-04-22 2022-04-22 3 3
#> 2: 2022-04-19 2022-04-19 0 0