setInstantExposure: Definition of instant exposure dataset

View source: R/dataConstruction_workflow.R

setInstantExposureR Documentation

Definition of instant exposure dataset

Description

The instant exposure dataset specifies all follow-up dates when a study subject is exposed to a non-reference exposure level. For each instanteneous exposures, the table specifies:

  1. a unique subject identifier,

  2. the exposure date,

  3. the exposure level (required only when the exposure is not binary).

Usage

setInstantExposure(data, IDvar, exp_date, exp_level = NA)

Arguments

data

data.table containing the input exposure dataset to be wrapped in and processed. The table can contain multiple rows per subject. There should be no row for subjects who are only exposed to the reference exposure level during follow-up. Exposure levels must be encoded by one or more character, integer, or numeric vector(s). Multiple rows per subject and date are permitted. Cannot contain missing values. Cannot have columns named 'IDvar', 'start_date', or 'exp_level'.

IDvar

character providing the name of the column of data that contains the unique subject identifier.

exp_date

character providing the name of the column of data that contains the exposure date.

exp_level

character vector providing the name(s) of the column(s) of data that encode(s) the non-reference exposure level(s). Can be missing if there is only one non-reference exposure level. If missing, the exposure is assumed to be binary and its reference level is encoded by 0.

Value

instExpData object

See Also

instantExpData

Examples

exposure <- setInstantExposure(expDT6, "ID", "fillDate", c("D.t","Q.t"))

romainkp/LtAtStructuR documentation built on Aug. 24, 2024, 3:38 p.m.