Skip to contents

Add or remove an imputation method in the intervals of a PKNCAdata object

Usage

interval_add_impute(
  data,
  target_impute,
  after = Inf,
  target_params = NULL,
  target_groups = NULL,
  ...
)

interval_remove_impute(
  data,
  target_impute,
  target_params = NULL,
  target_groups = NULL,
  ...
)

Arguments

data

A PKNCAdata object or a data.frame of intervals.

target_impute

The imputation method to add or remove, as a character string (see PKNCA_impute_method).

after

Where to insert the method within any imputation already present, following base::append(): 0 makes it first and Inf (the default) makes it last. A method that is already present is moved to the requested position rather than duplicated.

target_params

Restrict the change to these NCA parameters. NULL (the default) applies it to every parameter being calculated.

target_groups

A data.frame of group values restricting the change to matching intervals. Every column must match (and) for at least one row of target_groups (or). NULL (the default) applies the change to all intervals.

...

Ignored.

Value

The input with the imputation updated. An interval is split into more than one row when its parameters no longer share the same imputation, and rows that come to share every value are merged.

Examples

intervals <- data.frame(start = 0, end = 24, cmax = TRUE, half.life = TRUE)
# Impute a starting concentration for everything in the interval
interval_add_impute(intervals, target_impute = "start_conc0")
#>   start end cmax half.life      impute
#> 1     0  24 TRUE      TRUE start_conc0
# ... but not for half-life, which splits the interval into two rows
interval_add_impute(intervals, target_impute = "start_conc0", target_params = "cmax")
#>   start end  cmax half.life      impute
#> 1     0  24  TRUE     FALSE start_conc0
#> 2     0  24 FALSE      TRUE        <NA>