Exclude NCA Results Based on Parameter Thresholds
Source:R/exclude_nca_by_param.R
exclude_nca_by_param.Rd
Exclude rows from NCA results based on specified thresholds for a given parameter. This function allows users to define minimum and/or maximum acceptable values for a parameter and excludes rows that fall outside these thresholds.
Usage
exclude_nca_by_param(
parameter,
min_thr = NULL,
max_thr = NULL,
affected_parameters = parameter
)
Arguments
- parameter
The name of the PKNCA parameter to evaluate (e.g., "span.ratio").
- min_thr
The minimum acceptable value for the parameter. If not provided, is not applied.
- max_thr
The maximum acceptable value for the parameter. If not provided, is not applied.
- affected_parameters
Character vector of PKNCA parameters that will be marked as excluded. By default is the defined parameter.
Value
A function that can be used with PKNCA::exclude
to mark through the 'exclude' column
the rows in the PKNCA results based on the specified thresholds for a parameter.
Examples
# Example dataset
my_data <- PKNCA::PKNCAdata(
PKNCA::PKNCAconc(data.frame(conc = c(1, 2, 3, 4),
time = c(0, 1, 2, 3),
subject = 1),
conc ~ time | subject),
PKNCA::PKNCAdose(data.frame(subject = 1, dose = 100, time = 0),
dose ~ time | subject)
)
my_result <- PKNCA::pk.nca(my_data)
#> Warning: Too few points for half-life calculation (min.hl.points=3 with only 0 points)
# Exclude rows where span.ratio is less than 100
excluded_result <- PKNCA::exclude(
my_result,
FUN = exclude_nca_by_param("span.ratio", min_thr = 100)
)
as.data.frame(excluded_result)
#> # A tibble: 14 × 6
#> subject start end PPTESTCD PPORRES exclude
#> <dbl> <dbl> <dbl> <chr> <dbl> <chr>
#> 1 1 0 24 auclast 7.5 NA
#> 2 1 0 Inf cmax 4 NA
#> 3 1 0 Inf tmax 3 NA
#> 4 1 0 Inf tlast 3 NA
#> 5 1 0 Inf clast.obs 4 NA
#> 6 1 0 Inf lambda.z NA Too few points for half-life…
#> 7 1 0 Inf r.squared NA Too few points for half-life…
#> 8 1 0 Inf adj.r.squared NA Too few points for half-life…
#> 9 1 0 Inf lambda.z.time.first NA Too few points for half-life…
#> 10 1 0 Inf lambda.z.n.points NA Too few points for half-life…
#> 11 1 0 Inf clast.pred NA Too few points for half-life…
#> 12 1 0 Inf half.life NA Too few points for half-life…
#> 13 1 0 Inf span.ratio NA Too few points for half-life…
#> 14 1 0 Inf aucinf.obs NA Too few points for half-life…