epict_make_time_rel: Make time relative to first date of the test.

View source: R/preprocess.R

epict_make_time_relR Documentation

Make time relative to first date of the test.

Description

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.

Value

A data.table with a t variable containing the numeric time in days since the baseline_date.

Author(s)

Sam Abbott

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)

# Using user specified baseline date
epict_make_time_rel(obs, baseline_date = as.Date("2022-04-01"))

# When onsets are present
obs$onset_date <- obs$test_date
epict_make_time_rel(obs)

seabbs/epict documentation built on July 3, 2023, 6:42 a.m.