billdenney / pknca

An R package is designed to perform all noncompartmental analysis (NCA) calculations for pharmacokinetic (PK) data.
http://billdenney.github.io/pknca/
GNU Affero General Public License v3.0
67 stars 24 forks source link

For special columns (like volume), it should be an error to try to calculate without the column specified #194

Open billdenney opened 1 year ago

billdenney commented 1 year ago

This should be an error because ae is requested but volume is not given. (Related to #166)

library(PKNCA)
#> 
#> Attaching package: 'PKNCA'
#> The following object is masked from 'package:stats':
#> 
#>     filter
conc_obj <- PKNCAconc(as.data.frame(datasets::Theoph), conc~Time|Subject)

d_dose <- unique(datasets::Theoph[datasets::Theoph$Time == 0,
                                  c("Dose", "Time", "Subject")])
dose_obj <- PKNCAdose(d_dose, Dose~Time|Subject)
d_intervals <- data.frame(start = 0, end = 24, ae = TRUE)
data_obj <- PKNCAdata(conc_obj, dose_obj, intervals = d_intervals)
summary(pk.nca(data_obj))
#>  start end  N ae
#>      0  24 12 NC
#> 
#> Caption: ae: geometric mean and geometric coefficient of variation

Created on 2022-11-16 with reprex v2.0.2