cov_apply {apmx}R Documentation

Apply covariates to PK(PD) dataset

Description

Add covariates to a dataset built by pk_build() or pk_combine() Can add subject-level covariates (by any ID variable) or time-varying (by any time variable)

Usage

cov_apply(
  df,
  cov,
  id.by = "USUBJID",
  time.by = NA,
  direction = "downup",
  exp = FALSE,
  ebe = FALSE,
  cov.rnd = NA,
  na = -999,
  demo.map = TRUE,
  keep.other = TRUE
)

Arguments

df

PK(PD) dataframe generated by pk_build

cov

dataframe of covariates

id.by

id variable to merge covariates

time.by

time variable to merge covariates

direction

fill direction for time-varying covariates

exp

treats new covariates as exposure metrics when TRUE

ebe

treats new covariates as empirical bayes estimates when TRUE

cov.rnd

covariate rounding parameter

na

value to replace NA numeric covariates

demo.map

toggle pre-set numeric values for SEX, RACE, and ETHNIC demographic variables

keep.other

filter to keep or remove other events, EVID = 2

Value

PK(PD) dataset with additional covariates]

Examples

## Simple ex domain with 1 subject and 1 dose
ex <- data.frame(STUDYID = "ABC101",
                 USUBJID = "ABC101-001",
                 EXSTDTC = "2000-01-01 10:00:00",
                 EXSTDY = 1,
                 EXTPTNUM = 0,
                 EXDOSE = 100,
                 CMT = 1,
                 EXTRT = "ABC",
                 EXDOSU = "mg",
                 VISIT = "Day 1",
                 EXTPT = "Dose",
                 EXDOSFRQ = "Once",
                 EXROUTE = "Oral")

## Simple pc domain with 1 subject and 3 observations
pc <- data.frame(USUBJID = "ABC101-001",
                 PCDTC = c("2000-01-01 09:40:00",
                           "2000-01-01 10:29:00",
                           "2000-01-01 12:05:00"),
                 PCDY = 1,
                 PCTPTNUM = c(0, ##Units of hours
                              0.021,
                              0.083),
                 PCSTRESN = c(NA,
                              469,
                              870),
                 PCLLOQ = 25,
                 CMT = 2,
                 VISIT = "Day 1",
                 PCTPT = c("Pre-dose",
                           "30-min post-dose",
                           "2-hr post-dose"),
                 PCTEST = "ABC",
                 PCSTRESU = "ug/mL")

## Create with pk_build()
df <- pk_build(ex, pc)

## Simple dm domain for the corresponding study
dm <- data.frame(USUBJID = c("ABC101-001",
                             "ABC101-002",
                             "ABC101-003"),
                 AGE = c(45,
                         37,
                         73),
                 AGEU = "years",
                 SEX = c("Male",
                         "Female",
                         "Male"),
                 RACE = c("White",
                          "White",
                          "Black"),
                 ETHNIC = c("Not Hispanic/Latino",
                            "Not Hispanic/Latino",
                            "Not Hispanic/Latino"))

## Add covariates with cov_apply()
df1 <- cov_apply(df, dm)


[Package apmx version 1.1.1 Index]