Title: | Automated Population Pharmacokinetic Dataset Assembly |
---|---|
Description: | Automated methods to assemble population PK (pharmacokinetic) and PKPD (pharmacodynamic) datasets for analysis in 'NONMEM' (non-linear mixed effects modeling) by Bauer (2019) <doi:10.1002/psp4.12404>. The package includes functions to build datasets from SDTM (study data tabulation module) <https://www.cdisc.org/standards/foundational/sdtm>, ADaM (analysis dataset module) <https://www.cdisc.org/standards/foundational/adam>, or other dataset formats. The package will combine population datasets, add covariates, and create documentation to support regulatory submission and internal communication. |
Authors: | Stephen Amori [aut, cre, cph], Ethan DellaMaestra [aut], Michael Dick [aut], Daniel Litow [ctb], Jonah Lyon [ctb] |
Maintainer: | Stephen Amori <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.1.1 |
Built: | 2025-03-13 04:47:16 UTC |
Source: | https://github.com/stephen-amori/apmx |
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)
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 )
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 )
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 |
PK(PD) dataset with additional covariates]
## 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)
## 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)
Can filter for categorical, continuous, or other covariates. Can filter for numeric or character type.
cov_find(df, cov, type)
cov_find(df, cov, type)
df |
PK(PD) dataset |
cov |
covariate distribution |
type |
covariate type |
vector of desired column names
## 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) ## Find covariates with cov_find() cov_find(df1, cov="categorical", type="numeric") cov_find(df1, cov="categorical", type="character") cov_find(df1, cov="continuous", type="numeric") cov_find(df1, cov="units", type="character")
## 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) ## Find covariates with cov_find() cov_find(df1, cov="categorical", type="numeric") cov_find(df1, cov="categorical", type="character") cov_find(df1, cov="continuous", type="numeric") cov_find(df1, cov="units", type="character")
Randomly generated demographic data domain
DM
DM
## 'DM' A data frame with 22 rows and 12 variables:
study label
site code
subject code
unique subject ID
screen fail flag
informed consent date
informed consent date character form
date of birth
subject baseline age
subject sex
subject race
subject ethnicity
Randomly generated exposure domain
EX
EX
## 'EX' A data frame with 42 rows and 19 variables:
study label
site code
unique subject ID
domain category
visit label
numeric study day
visit numeric code
treatment label
treatment amount
treatment unit label
treatment route label
treatment frequency
treatment administration date
treatment administration date character form
treatment administration time
treatment administration time character form
treatment administration date and time
treatment timepoint label
treatment numeric timepoint
Randomly generated laboratory data domain
LB
LB
## 'LB' A data frame with 2159 rows and 16 variables:
study label
site code
unique subject ID
domain category
completion flag
date of assessment
visit label
visit numeric code
timepoint label
timepoint numeric code
parameter code
parameter
original parameter result
original parameter result, character form
original parameter unit label
Randomly generated pharmacokinetic observation domain
PC
PC
## 'PC' A data frame with 420 rows and 19 variables:
study label
site code
unique subject ID
domain category
analyte category
visit label
study numeric day
visit numeric code
timepoint label
timepoint numeric code
completion status
observation date
observation time
observation time character form
observation date and time
original pharmacokinetic observation
original pharmacokinetic observation unit label
standardized pharmacokinetic numeric observation
standardized pharmacokinetic character observation
standardized pharmacokinetic observation unit label
standardized pharmacokinetic observation lower limit of quantification
Input a pre-processed ex and pc domain for combination into a NONMEM dataset. Additional pd endpoints, subject-level covariates, and time-varying covariates can also be added. Other parameters can customize some calculations and formatting.
pk_build( ex, pc = NA, pd = NA, sl.cov = NA, tv.cov = NA, time.units = "days", cycle.length = NA, na = -999, time.rnd = NULL, amt.rnd = NULL, dv.rnd = NULL, cov.rnd = NULL, impute = NA, BDV = FALSE, DDV = FALSE, PDV = FALSE, sparse = 3, demo.map = TRUE, tv.cov.fill = "downup", keep.other = TRUE )
pk_build( ex, pc = NA, pd = NA, sl.cov = NA, tv.cov = NA, time.units = "days", cycle.length = NA, na = -999, time.rnd = NULL, amt.rnd = NULL, dv.rnd = NULL, cov.rnd = NULL, impute = NA, BDV = FALSE, DDV = FALSE, PDV = FALSE, sparse = 3, demo.map = TRUE, tv.cov.fill = "downup", keep.other = TRUE )
ex |
dose event dataframe |
pc |
pc event dataframe |
pd |
pd event dataframe |
sl.cov |
subject-level covariate dataframe |
tv.cov |
time-varying covariate dataframe |
time.units |
units for time attributes |
cycle.length |
cycle length in units of days |
na |
value for missing numeric items |
time.rnd |
time attribute rounding parameter |
amt.rnd |
amount attribute rounding parameter |
dv.rnd |
dependent variable attribute rounding parameter |
cov.rnd |
covariate attribute rounding parameter |
impute |
imputation method |
BDV |
baseline pd attribute |
DDV |
change from baseline pd attribute |
PDV |
percent change from baseline pd attribute |
sparse |
threshold for sparse sampling |
demo.map |
toggle pre-set numeric values for SEX, RACE, and ETHNIC demographic variables |
tv.cov.fill |
time-varying covariate fill direction |
keep.other |
filter to keep or remove other events, EVID = 2 |
PK(PD) dataset
## 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 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)
Input two datasets created by pk_build(). Any character descriptions that were numerically mapped will be re-mapped to the whole population.
pk_combine(df1, df2, demo.map = TRUE, na = -999)
pk_combine(df1, df2, demo.map = TRUE, na = -999)
df1 |
original PK(PD) dataset |
df2 |
additional PK(PD) dataset |
demo.map |
toggle pre-set numeric values for SEX, RACE, and ETHNIC demographic variables |
na |
value for missing numeric items |
population PK(PD) dataset
## Simple ex domain with 1 subject and 1 dose, study 101 ex101 <- 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 ex domain with 1 subject and 1 dose, study 102 ex102 <- data.frame(STUDYID = "ABC102", USUBJID = "ABC102-001", EXSTDTC = "2001-01-01 08:09:00", EXSTDY = 1, EXTPTNUM = 0, EXDOSE = 200, CMT = 1, EXTRT = "ABC", EXDOSU = "mg", VISIT = "Day 1", EXTPT = "Dose", EXDOSFRQ = "QW", EXROUTE = "Oral") ## Simple pc domain with 1 subject and 3 observations, study 101 pc101 <- 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") ## Simple pc domain with 1 subject and 3 observations, study 102 pc102 <- data.frame(USUBJID = "ABC102-001", PCDTC = c("2001-01-01 08:05:00", "2001-01-01 11:38:00", "2001-01-02 08:11:00"), PCDY = 1, PCTPTNUM = c(0, ##Units of hours 0.125, 1), PCSTRESN = c(NA, 1150, 591), PCLLOQ = 25, CMT = 2, VISIT = "Day 1", PCTPT = c("Pre-dose", "2-4 hr post-dose", "24 hr post-dose"), PCTEST = "ABC", PCSTRESU = "ug/mL") ## Create with pk_build() df101 <- pk_build(ex101, pc101) df102 <- pk_build(ex102, pc102) ## Combine with pk_combine() df_combine <- pk_combine(df101, df102)
## Simple ex domain with 1 subject and 1 dose, study 101 ex101 <- 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 ex domain with 1 subject and 1 dose, study 102 ex102 <- data.frame(STUDYID = "ABC102", USUBJID = "ABC102-001", EXSTDTC = "2001-01-01 08:09:00", EXSTDY = 1, EXTPTNUM = 0, EXDOSE = 200, CMT = 1, EXTRT = "ABC", EXDOSU = "mg", VISIT = "Day 1", EXTPT = "Dose", EXDOSFRQ = "QW", EXROUTE = "Oral") ## Simple pc domain with 1 subject and 3 observations, study 101 pc101 <- 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") ## Simple pc domain with 1 subject and 3 observations, study 102 pc102 <- data.frame(USUBJID = "ABC102-001", PCDTC = c("2001-01-01 08:05:00", "2001-01-01 11:38:00", "2001-01-02 08:11:00"), PCDY = 1, PCTPTNUM = c(0, ##Units of hours 0.125, 1), PCSTRESN = c(NA, 1150, 591), PCLLOQ = 25, CMT = 2, VISIT = "Day 1", PCTPT = c("Pre-dose", "2-4 hr post-dose", "24 hr post-dose"), PCTEST = "ABC", PCSTRESU = "ug/mL") ## Create with pk_build() df101 <- pk_build(ex101, pc101) df102 <- pk_build(ex102, pc102) ## Combine with pk_combine() df_combine <- pk_combine(df101, df102)
Definition file table can be read into a template word document (.docx) or blank document if desired. Definitions are sourced from a variable list stored separately on your server. Please refer to apmx::variable_list_export() for a standard copy of the variable list.
pk_define( df, file = NULL, project, data, variable.list, template = NULL, font = "Times New Roman", size = 9, na = -999 )
pk_define( df, file = NULL, project, data, variable.list, template = NULL, font = "Times New Roman", size = 9, na = -999 )
df |
apmx analysis dataset |
file |
optional filepath for defintion file (.docx file) |
project |
project name |
data |
dataset name |
variable.list |
reference dataframe for variable definitions |
template |
optional filepath for definition file template (.docx file) |
font |
font for table contents |
size |
font size for table contents |
na |
value used for missing or na numeric covariates |
dataset definition file
## 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 apmx dataset with pk_build() df <- pk_build(ex, pc) ## Create variable definitions with variable_list_create() vl <- variable_list_create() ## Create definition file pk_define(df, variable.list = vl)
## 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 apmx dataset with pk_build() df <- pk_build(ex, pc) ## Create variable definitions with variable_list_create() vl <- variable_list_create() ## Create definition file pk_define(df, variable.list = vl)
Summarize BLQ distributions, categorical covariates, and continuous covariates in three tables. Outputs are default .csv files, but can also be .docx and/or .pptx Tables are default stratified by study, but can be stratified by any variable requested by the user.
pk_summarize( df, dir = NA, strat.by = "NSTUDYC", ignore.c = TRUE, na = -999, docx = FALSE, pptx = FALSE, docx.font = "Times New Roman", docx.size = 9, docx.template = NULL, pptx.template = NULL, pptx.font = "Times New Roman", pptx.size = 12, docx.orientation = "portrait", ignore.request = c() )
pk_summarize( df, dir = NA, strat.by = "NSTUDYC", ignore.c = TRUE, na = -999, docx = FALSE, pptx = FALSE, docx.font = "Times New Roman", docx.size = 9, docx.template = NULL, pptx.template = NULL, pptx.font = "Times New Roman", pptx.size = 12, docx.orientation = "portrait", ignore.request = c() )
df |
dataset produced by pk_build(). |
dir |
filepath for output directory. |
strat.by |
vector of variables names to stratify the summary tables. |
ignore.c |
ignores records flagged in the C column when TRUE. |
na |
numeric value to be interpreted as NA or missing. |
docx |
creates summary tables as a Word document when TRUE. |
pptx |
creates summary tables as a PowerPoint document when TRUE. |
docx.font |
font for the summary tables in the Word document. |
docx.size |
font size for the summary tables in the Word document. |
docx.template |
filepath for template .docx file. When NULL, the summary tables print to a blank document. |
pptx.template |
filepath for template .pptx file. When NULL, the summary tables print to a blank slide. |
pptx.font |
font for the summary tables in the PowerPoint document. |
pptx.size |
font size for the summary tables in the PowerPoint document. |
docx.orientation |
orientation of .docx files. |
ignore.request |
vector of additional logical expressions to filter the datase prior to summary. |
summary tables as .csv, .docx, and .pptx files
## 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) ## Generate summary statistics with pk_summarize() pk_summarize(df)
## 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) ## Generate summary statistics with pk_summarize() pk_summarize(df)
Dataset created by pk_build() or pk_combine() will be outputted as a .csv file with NONMEM-standard formatting.
pk_write(df, file)
pk_write(df, file)
df |
PK(PD) dataframe |
file |
filepath |
writes dataset to specified location
## 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) ## Write with pk_write() name <- "dataset.csv" pk_write(df, file.path(tempdir(), name))
## 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) ## Write with pk_write() name <- "dataset.csv" pk_write(df, file.path(tempdir(), name))
Variable list should be used as an input to the apmx::pk_define() function. The user should add additional definitions to the file for custom columns with apmx::variable_list_add().
variable_list_create( variable = NULL, categorization = NULL, description = NULL, comment = NA )
variable_list_create( variable = NULL, categorization = NULL, description = NULL, comment = NA )
variable |
vector of variable names |
categorization |
vector of category names |
description |
vector of variable descriptions |
comment |
vector of variable comments (can be left NA) |
dataframe of standard variable definitions
vl <- variable_list_create(variable = c("WEIGHT", "HEIGHT"), categorization = rep("Covariate", 2), description = c("weight", "height"))
vl <- variable_list_create(variable = c("WEIGHT", "HEIGHT"), categorization = rep("Covariate", 2), description = c("weight", "height"))
Version log is outputted as a .docx file. Document tracks changes in subject count, record count, new variables, and changing variables. User comments in the word document are preserved between versions.
version_log( df, name, file = NULL, prevdata = NULL, template = NULL, comp_var, src_data = "", font = "Times New Roman", size = 9, orient = "landscape" )
version_log( df, name, file = NULL, prevdata = NULL, template = NULL, comp_var, src_data = "", font = "Times New Roman", size = 9, orient = "landscape" )
df |
filepath of new dataset |
name |
name of the dataset (filename with .csv suffix) |
file |
filepath for version log file (.docx) |
prevdata |
comparison dataset filepath |
template |
template docx filepath |
comp_var |
grouping variables for comparison |
src_data |
string to describe source data |
font |
font style |
size |
font size |
orient |
document orientation |
version log as a .docx file
## 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) ## Document with version_log() vlog <- version_log(df, name = "PK_DATA_V01.csv")
## 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) ## Document with version_log() vlog <- version_log(df, name = "PK_DATA_V01.csv")
Variable list with apmx variables and definitions
VL
VL
## 'VL' A data frame with 66 rows and 4 variables:
Column or variable name
Column or variable category
Column or variable description
NA by default