run_DrugLevel: Run Drug Level Data

Description Usage Arguments Details Value Examples

View source: R/modDrugLevel.R

Description

This module will load and modify drug-level data.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
run_DrugLevel(
  conc.path,
  conc.select,
  conc.rename,
  conc.mod.list = list(mod_id_event = expression(paste(mod_id_visit, event, sep =
    "_"))),
  samp.path = NULL,
  samp.mod.list = list(mod_id_event = expression(paste(mod_id_visit, samp, sep = "_"))),
  check.path,
  failmiss_fn = "MissingConcDate-",
  multsets_fn = "multipleSetsConc-",
  faildup_fn = "DuplicateConc-",
  drugname,
  LLOQ,
  demo.list = NULL
)

Arguments

conc.path

filename of concentration data (stored as RDS)

conc.select

columns to select from concentration data

conc.rename

new column names for concentration data

conc.mod.list

list of expressions, giving modifications to make

samp.path

filename of data with sampling time (stored as RDS)

samp.mod.list

list of expressions, giving modifications to make

check.path

path to ‘check’ directory, where check files are created

failmiss_fn

filename for data missing concentration date

multsets_fn

filename for data with multiple concentration sets

faildup_fn

filename for data with duplicate concentration observations

drugname

drug of interest, included in filename of check files

LLOQ

lower limit of concentration values; values below this are invalid

demo.list

demographic information; if available, concentration records must have a valid demo record

Details

See EHR Vignette for Structured Data.

Value

drug-level data set

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## Not run: 
# concentrations
conc_data <- data.frame(mod_id = rep(1:3,each=4),
                       mod_visit = rep(c(2,1,1),each=4),
                       mod_id_visit = as.numeric(paste(rep(1:3,each=4),
                                                      rep(c(2,1,1),each=4), sep=".")),
                       samp = rep(1:4,times=3),
                       drug_calc_conc=15*exp(-1*rep(1:4,times=3))+rnorm(12,0,0.1))

saveRDS(conc_data,'conc_data.rds')

# sample times
build_date <- function(x) as.character(seq(x, length.out=4, by="1 hour"))
dates <- unlist(lapply(rep(Sys.time(),3), build_date))

samp_data <- data.frame(mod_id = rep(1:3,each=4),
                       mod_visit = rep(c(2,1,1),each=4),
                       mod_id_visit = as.numeric(paste(rep(1:3,each=4),
                                                       rep(c(2,1,1),each=4), sep=".")),
                       samp = rep(1:4,times=3),
                       Sample.Collection.Date.and.Time = dates)

saveRDS(samp_data,'samp_data.rds')

run_DrugLevel(
  conc.path='conc_data.rds',
  conc.select=c('mod_id','mod_id_visit','samp','drug_calc_conc'),
  conc.rename=c(drug_calc_conc= 'conc.level', samp='event'),
  conc.mod.list = list(mod_id_event = expression(paste(mod_id_visit, event, sep = "_"))),
  samp.path = 'samp_data.rds',
  samp.mod.list = list(mod_id_event = expression(paste(mod_id_visit, samp, sep = "_"))),
  check.path = tempdir(),
  drugname = 'drugnm',
  LLOQ = 0.05
)

## End(Not run)

EHR documentation built on June 9, 2021, 9:07 a.m.