setExposure: Definition of exposure dataset

View source: R/dataConstruction_workflow.R

setExposureR Documentation

Definition of exposure dataset

Description

The exposure dataset specifies all follow-up time intervals during which a study subject is exposed to an exposure level other than a reference level specified by the analyst. For each episode of exposure to a non-reference level, the table specifies:

  1. a unique subject identifier,

  2. the exposure episode start date,

  3. the exposure episode end date, and

  4. the non-reference exposure level (required only when the exposure is not binary).

Usage

setExposure(data, IDvar, start_date, end_date, exp_level = NA, exp_ref = 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 a character vector or an integer vector. There cannot be any overlapping exposure episodes. Cannot contain missing values. Cannot have columns named 'IDvar', 'start_date', 'end_date', 'exposure', or 'exp_level'.

IDvar

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

start_date

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

end_date

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

exp_level

character providing the name of the column of data that contains the non-reference exposure level. Can be missing only if exp_ref is also missing. If missing, the exposure is assumed to be binary and its reference level is encoded by 0.

exp_ref

character or integer identifying the exposure reference level. Cannot be a value of the exp_level column of data. Can be missing only if exp_level is also missing.

Value

expData object

See Also

expData

Examples

exposure <- setExposure(expDT, "ID", "startA", "endA")

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