Make time relative to first uncensored test per ID
Source:R/preprocess.R
epict_make_time_rel_to_first_uncensored.Rd
Make time relative to first uncensored test per ID
Arguments
- obs
A data.frame with the following variables:
id
: An integer vector uniquely identifying each infection.t
: Time of test relative to a baseline date.onset_t
: Time on onset relative to a baseline date (optional).censored
: Logical, indicating if the Ct has been censored.
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()
Examples
obs <- data.frame(
id = c(rep(1, 3), rep(2, 4)), t = c(2, 3, 4, 1, 1, 2, 8),
onset_t = c(rep(2, 3), rep(4, 4)),
censored = c(TRUE, FALSE, FALSE, TRUE, rep(FALSE, 3))
)
epict_make_time_rel_to_first_uncensored(obs)
#> id t onset_t censored t_first_uncensored t_rel_uncensored
#> 1: 1 2 2 TRUE 3 -1
#> 2: 1 3 2 FALSE 3 0
#> 3: 1 4 2 FALSE 3 1
#> 4: 2 1 4 TRUE 1 0
#> 5: 2 1 4 FALSE 1 0
#> 6: 2 2 4 FALSE 1 1
#> 7: 2 8 4 FALSE 1 7
#> onset_t_rel_uncensored
#> 1: -1
#> 2: -1
#> 3: -1
#> 4: 3
#> 5: 3
#> 6: 3
#> 7: 3