Reads a NONMEM-style dataset and applies the Data Input page's options, so
that plots, NCA and overlays see the same data as in the app: column names
in upper case and without #/@, CMT, ID and TIME columns created
when missing (from e.g. USUBJID or TAFD), BLQ rows removed, change from
baseline columns (DV_CFB, DV_CFBPCT) added, and optional filters (the
app's code editor).
Usage
mvp_data(
data,
...,
remove_dosing = FALSE,
remove_blq = TRUE,
cfb = TRUE,
one_per_subject = FALSE,
numeric = FALSE
)Arguments
- data
A data frame, or the path of a
.csv(or tab-delimited.txt) file.- ...
Filters, as in
dplyr::filter(), e.g.DOSE == 100, CMT == 2.- remove_dosing
Remove dosing rows (
EVID >= 1).- remove_blq
Remove BLQ observations (
BLQ >= 1).- cfb
Add change from baseline columns:
DV_CFBandDV_CFBPCTfrom the first observedDVperIDandCMT.- one_per_subject
Keep one row per
ID.- numeric
Convert all columns to numbers (text becomes
NA).
Examples
d <- data.frame(id = rep(1:2, each = 3), time = rep(c(0, 1, 2), 2),
dv = c(10, 8, 5, 12, 9, 7), dose = rep(c(50, 100), each = 3))
mvp_data(d)
#> ID TIME DV DV_CFB DV_CFBPCT DOSE CMT
#> 1 1 0 10 0 0.00000 50 2
#> 2 1 1 8 -2 -20.00000 50 2
#> 3 1 2 5 -5 -50.00000 50 2
#> 4 2 0 12 0 0.00000 100 2
#> 5 2 1 9 -3 -25.00000 100 2
#> 6 2 2 7 -5 -41.66667 100 2
mvp_data(d, DOSE == 100)
#> ID TIME DV DV_CFB DV_CFBPCT DOSE CMT
#> 1 2 0 12 0 0.00000 100 2
#> 2 2 1 9 -3 -25.00000 100 2
#> 3 2 2 7 -5 -41.66667 100 2