Introduction

To run the tests, the package must be installed with its tests:

  • To install from CRAN:
    • install.packages(pkgs="PKNCA", INSTALL_opts="--install-tests", type="source")
  • To install from GitHub:
    • library(devtools)
    • install_github("billdenney/pknca", INSTALL_opts="--install-tests")

Testing and validation that results match in a local environment compared to the original environment is an important part of confirmation that a package works as expected.

Re-running this vignette in your local environment will confirm that local results match those in the original package development. Test success is confirmed by the existence of no failed tests; warnings are expected during testing (and not shown in this vignette for that reason); and some tests may be skipped, but those are expected as well.

Summary of Testing

The following sentence is dynamically generated to summarize the testing results: All tests passed.

Testing Log

Interval columns

Testing Filename Test Description Number of Tests Number of Failed Tests
test-001-add.interval.col.R add.interval.col 16 0

AIC.list testing

Testing Filename Test Description Number of Tests Number of Failed Tests
test-AIC.list.R AIC.list 5 0
test-AIC.list.R get.first.model 15 0
test-AIC.list.R get.best.model 1 0

AUC and AUMC

Testing Filename Test Description Number of Tests Number of Failed Tests
test-auc.R pk.calc.auxc 9 0
test-auc.R pk.calc.auc 94 0
test-auc.R pk.calc.auc.last 2 0
test-auc.R pk.calc.auc.inf 2 0
test-auc.R pk.calc.auc.all 2 0
test-auc.R pk.calc.aumc 3 0
test-auc.R pk.calc.aumc.inf 2 0
test-auc.R pk.calc.aumc.all 2 0
test-auc.R pk.calc.aumc.last 2 0
test-auc.R pk.calc.auc.inf.pred 1 0
test-auc.R pk.calc.aumc.inf.obs 1 0
test-auc.R pk.calc.aumc.inf.pred 1 0

aucint

Testing Filename Test Description Number of Tests Number of Failed Tests
test-aucint.R AUCint gives errors appropriately 18 0
test-aucint.R AUCint gives the same value when no interpolation/extrapolation is required 3 0
test-aucint.R AUCint gives a warning and NA when it cannot interpolate or extrapolate a value 4 0
test-aucint.R AUCint respects auc.type and does the correct calculations for each AUC type 9 0
test-aucint.R aucint respects doses 3 0
test-aucint.R aucint works with infinite intervals 4 0

AUC interval checking

Testing Filename Test Description Number of Tests Number of Failed Tests
test-check.intervals.R check.interval.specification 24 0
test-check.intervals.R check.interval.deps 1 0
test-check.intervals.R get.parameter.deps 5 0
test-check.intervals.R check.intervals requires a valid value 1 0
test-check.intervals.R check.intervals works with tibble input (fix #141) 1 0

Determining tau for AUCs

Testing Filename Test Description Number of Tests Number of Failed Tests
test-choose-intervals.R find.tau 16 0
test-choose-intervals.R choose.auc.intervals 10 0

Class generation-general

Testing Filename Test Description Number of Tests Number of Failed Tests
test-class-general.R getColumnValueorNot 3 0
test-class-general.R setAttributeColumn 19 0
test-class-general.R getAttributeColumn 10 0
test-class-general.R getDataName.default returns NULL 4 0

Class generation-PKNCAconc

Testing Filename Test Description Number of Tests Number of Failed Tests
test-class-PKNCAconc.R PKNCAconc 12 0
test-class-PKNCAconc.R PKNCAconc with input other than data.frames 1 0
test-class-PKNCAconc.R model frame and parameter extractions 14 0
test-class-PKNCAconc.R print.PKNCAconc 3 0
test-class-PKNCAconc.R summary.PKNCAconc 1 0
test-class-PKNCAconc.R PKNCAconc with exclusions 1 0
test-class-PKNCAconc.R PKNCAconc with duration 1 0
test-class-PKNCAconc.R PKNCAconc with nominal time added 2 0
test-class-PKNCAconc.R PKNCAconc with volume added 3 0

Class generation-PKNCAdata

Testing Filename Test Description Number of Tests Number of Failed Tests
test-class-PKNCAdata.R PKNCAdata 10 0
test-class-PKNCAdata.R PKNCAdata with no or limited dose information 4 0
test-class-PKNCAdata.R print.PKNCAdata 3 0
test-class-PKNCAdata.R summary.PKNCAdata 1 0
test-class-PKNCAdata.R no intervals auto-determined (Fix GitHub issue #84) 3 0
test-class-PKNCAdata.R Ensure that unexpected arguments to PKNCAdata give an error (related to issue #83) 1 0
test-class-PKNCAdata.R intervals may be a tibble 1 0

Class generation-PKNCAdose

Testing Filename Test Description Number of Tests Number of Failed Tests
test-class-PKNCAdose.R PKNCAdose 12 0
test-class-PKNCAdose.R PKNCAdose without a data.frame as input 1 0
test-class-PKNCAdose.R PKNCAdose model.frame 15 0
test-class-PKNCAdose.R print.PKNCAdose 4 0
test-class-PKNCAdose.R PKNCAdose with exclusions 1 0
test-class-PKNCAdose.R PKNCAdose route and duration 6 0
test-class-PKNCAdose.R time.nominal within PKNCAdose 3 0
test-class-PKNCAdose.R setDuration 3 0

Class generation-PKNCAresults

Testing Filename Test Description Number of Tests Number of Failed Tests
test-class-PKNCAresults.R PKNCAresults generation 8 0
test-class-PKNCAresults.R PKNCAresults has exclude, when applicable 3 0
test-class-PKNCAresults.R PKNCAresults summary 6 0
test-class-PKNCAresults.R dropping start and end from groups is allowed with a warning. 2 0
test-class-PKNCAresults.R summary.PKNCAresults manages exclusions as missing not as non-existent. 3 0
test-class-PKNCAresults.R print.summary_PKNCAresults works 1 0
test-class-PKNCAresults.R ptr works as a parameter 1 0
test-class-PKNCAresults.R exclude values are maintained in derived parameters during automatic calculation (#112) 3 0
test-class-PKNCAresults.R ctrough is correctly calculated 2 0
test-class-PKNCAresults.R single subject, ungrouped data works (#74) 2 0

Missing and BLQ data cleaners

Testing Filename Test Description Number of Tests Number of Failed Tests
test-cleaners.R clean.conc.na 19 0
test-cleaners.R clean.conc.blq 28 0

exclude_nca

Testing Filename Test Description Number of Tests Number of Failed Tests
test-exclude_nca.R exclude_nca 9 0

exclude

Testing Filename Test Description Number of Tests Number of Failed Tests
test-exclude.R setExcludeColumn 14 0
test-exclude.R exclude.default 17 0
test-exclude.R normalize_exclude makes blanks into NA_character_ 3 0
test-exclude.R multiple exclusions for the same row provide all the reasons (fix #113) 1 0

Check Conversion

Testing Filename Test Description Number of Tests Number of Failed Tests
test-general.functions.R check.conversion 3 0

Check concentration and time inputs

Testing Filename Test Description Number of Tests Number of Failed Tests
test-general.functions.R check.conc.time 13 0

Rounding to string values

Testing Filename Test Description Number of Tests Number of Failed Tests
test-general.functions.R Rounding 21 0
test-general.functions.R Significance 33 0
test-general.functions.R signifString stops when bad arguments are passed 1 0
test-general.functions.R max_na and min_na 8 0

Half-life

Testing Filename Test Description Number of Tests Number of Failed Tests
test-half.life.R pk.calc.half.life 11 0
test-half.life.R half-life manual point selection 5 0
test-half.life.R two-point half-life succeeds (fix #114) 2 0

Interpolation and extrapolation of concentration

Testing Filename Test Description Number of Tests Number of Failed Tests
test-interpolate.conc.R extrapolate.conc 25 0
test-interpolate.conc.R interpolate.conc 32 0
test-interpolate.conc.R interp.extrap.conc 5 0
test-interpolate.conc.R interp.extrap.conc.dose handles all eventualities 25 0
test-interpolate.conc.R interp.extrap.conc.dose 26 0

Formula parsing

Testing Filename Test Description Number of Tests Number of Failed Tests
test-parseFormula.R parseFormula 14 0
test-parseFormula.R formula.parseFormula 11 0
test-parseFormula.R print.parseFormula 4 0
test-parseFormula.R findOperator 31 0

Business rule functions

Testing Filename Test Description Number of Tests Number of Failed Tests
test-pk.business.rules.R geomean 10 0
test-pk.business.rules.R geosd 2 0
test-pk.business.rules.R geocv 2 0
test-pk.business.rules.R business.mean 6 0
test-pk.business.rules.R pk.business 5 0

All NCA calculations

Testing Filename Test Description Number of Tests Number of Failed Tests
test-pk.calc.all.R pk.nca 14 0
test-pk.calc.all.R Calculations when dose time is missing 1 0
test-pk.calc.all.R Calculations when no dose info is given 2 0
test-pk.calc.all.R pk.nca with exclusions 3 0
test-pk.calc.all.R pk.calc.all with duration.dose required 1 0
test-pk.calc.all.R half life inclusion and exclusion 2 0
test-pk.calc.all.R No interval requested (e.g. for placebo) 3 0
test-pk.calc.all.R Volume-related calculations 2 0
test-pk.calc.all.R pk.nca can calculate values with group-level data 1 0
test-pk.calc.all.R Missing dose info for some subjects gives a warning, not a difficult-to-interpret error 1 0
test-pk.calc.all.R Ensure that options are respected during pk.nca call 1 0

C0 Calculations

Testing Filename Test Description Number of Tests Number of Failed Tests
test-pk.calc.c0.R pk.calc.c0 10 0
test-pk.calc.c0.R pk.calc.c0.method.logslope 6 0
test-pk.calc.c0.R pk.calc.c0.method.c0 2 0
test-pk.calc.c0.R pk.calc.c0.method.c1 5 0
test-pk.calc.c0.R pk.calc.c0.method.set0 2 0
test-pk.calc.c0.R pk.calc.c0.method.cmin 2 0

Dose-normalized NCA functions

Testing Filename Test Description Number of Tests Number of Failed Tests
test-pk.calc.dn.R pk.calc.dn 3 0
test-pk.calc.dn.R pk.calc.cmax 1 0

Simple NCA functions

Testing Filename Test Description Number of Tests Number of Failed Tests
test-pk.calc.simple.R adj.r.squared 4 0
test-pk.calc.simple.R pk.calc.cmax 12 0
test-pk.calc.simple.R pk.calc.cmin 12 0
test-pk.calc.simple.R pk.calc.tmax 8 0
test-pk.calc.simple.R pk.calc.tlast 7 0
test-pk.calc.simple.R pk.calc.clast.obs 7 0
test-pk.calc.simple.R pk.calc.thalf.eff 3 0
test-pk.calc.simple.R pk.calc.kel 3 0
test-pk.calc.simple.R pk.calc.cl 7 0
test-pk.calc.simple.R pk.calc.f 9 0
test-pk.calc.simple.R pk.calc.aucpext 13 0
test-pk.calc.simple.R pk.calc.mrt 1 0
test-pk.calc.simple.R pk.calc.mrt.iv 4 0
test-pk.calc.simple.R pk.calc.mrt.md 2 0
test-pk.calc.simple.R pk.calc.vz 13 0
test-pk.calc.simple.R pk.calc.vss and its wrappers 3 0
test-pk.calc.simple.R pk.calc.vd and its wrappers 8 0
test-pk.calc.simple.R pk.calc.cav 3 0
test-pk.calc.simple.R pk.calc.ctrough 4 0
test-pk.calc.simple.R pk.calc.ptr 2 0
test-pk.calc.simple.R pk.calc.tlag 4 0
test-pk.calc.simple.R pk.calc.deg.fluc 2 0
test-pk.calc.simple.R pk.calc.swing 3 0
test-pk.calc.simple.R pk.calc.ceoi 3 0

Urine

Testing Filename Test Description Number of Tests Number of Failed Tests
test-pk.calc.urine.R pk.calc.ae 1 0
test-pk.calc.urine.R pk.calc.clr 3 0
test-pk.calc.urine.R pk.calc.fe 2 0

PKNCA option setting

Testing Filename Test Description Number of Tests Number of Failed Tests
test-PKNCA.options.R PKNCA.options 92 0
test-PKNCA.options.R PKNCA.choose.option 9 0

PKNCA summary setting

Testing Filename Test Description Number of Tests Number of Failed Tests
test-PKNCA.options.R PKNCA.set.summary input checking 13 0
test-PKNCA.options.R PKNCA.set.summary exists for all paramters 1 0
test-PKNCA.options.R PKNCA.options.describe 1 0
test-PKNCA.options.R PKNCA.options fails when setting defaults and another option simultaneously 1 0

Testing Filename Test Description Number of Tests Number of Failed Tests
test-prepare_data.R prepare_* 4 0
test-prepare_data.R full_join for PKNCAconc, PKNCAdose, and PKNCAdata 4 0
test-prepare_data.R check_reserved_column_names 3 0
test-prepare_data.R standardize_column_names 7 0
test-prepare_data.R restore_group_col_names 5 0

Provenance

Testing Filename Test Description Number of Tests Number of Failed Tests
test-provenance.R provenance 10 0

Superposition

Testing Filename Test Description Number of Tests Number of Failed Tests
test-superpostion.R superposition inputs 74 0
test-superpostion.R superposition math 14 0
test-superpostion.R PKNCAconc superposition 1 0

time_calc()

Testing Filename Test Description Number of Tests Number of Failed Tests
test-time_calc.R Numeric time_calc() is successful with all scalar combinations of number and NA and numeric order. 9 0
test-time_calc.R Numeric time_calc() is successful with all vector combinations of number and NA and numeric order. 5 0
test-time_calc.R POSIXt objects work 5 0
test-time_calc.R difftime 4 0

time_above

Testing Filename Test Description Number of Tests Number of Failed Tests
test-time.above.R time_above expected errors 6 0
test-time.above.R time_above simple scenarios 1 0
test-time.above.R time_above linear 6 0

Time to steady-state

Testing Filename Test Description Number of Tests Number of Failed Tests
test-time.to.steady.state.R pk.tss.data.prep 11 0
test-time.to.steady.state.R pk.tss.stepwise.linear 15 0
test-time.to.steady.state.R pk.tss.monoexponential 9 0
test-time.to.steady.state.R pk.tss 7 0

Session Information

## [1] "2021-11-29"
## R version 4.1.1 (2021-08-10)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 18.04.5 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
## LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats     graphics  grDevices datasets  utils     methods   base     
## 
## other attached packages:
## [1] dplyr_1.0.7    testthat_3.1.0 knitr_1.36     PKNCA_0.9.5   
## 
## loaded via a namespace (and not attached):
##  [1] tidyselect_1.1.1  xfun_0.28         bslib_0.3.1       purrr_0.3.4      
##  [5] lattice_0.20-45   vctrs_0.3.8       generics_0.1.1    htmltools_0.5.2  
##  [9] yaml_2.2.1        utf8_1.2.2        rlang_0.4.12      pkgdown_1.6.1    
## [13] jquerylib_0.1.4   pillar_1.6.4      glue_1.5.0        withr_2.4.2      
## [17] DBI_1.1.1         waldo_0.3.1       lifecycle_1.0.1   stringr_1.4.0    
## [21] ragg_1.2.0        memoise_2.0.0     evaluate_0.14     fastmap_1.1.0    
## [25] parallel_4.1.1    fansi_0.5.0       highr_0.9         renv_0.14.0      
## [29] cachem_1.0.6      desc_1.4.0        jsonlite_1.7.2    systemfonts_1.0.3
## [33] fs_1.5.0          textshaping_0.3.6 digest_0.6.28     stringi_1.7.5    
## [37] rprojroot_2.0.2   grid_4.1.1        cli_3.1.0         tools_4.1.1      
## [41] magrittr_2.0.1    sass_0.4.0        tibble_3.1.6      crayon_1.4.2     
## [45] tidyr_1.1.4       pkgconfig_2.0.3   ellipsis_0.3.2    MASS_7.3-54      
## [49] assertthat_0.2.1  rmarkdown_2.11    rstudioapi_0.13   R6_2.5.1         
## [53] nlme_3.1-153      compiler_4.1.1