Combine prediction tables
combine_prediction_tables.Rd
Combines multiple prediction tables (e.g., from different models or regions) into a single table. Supports weighted combination and collapsing regions.
Arguments
- predtabs
A list of prediction tables (data frames) to be combined.
- wts
A vector of weights, with the same length as
predtabs
. Default is equal weights.- collapse_regions
A logical value; if TRUE, regions are collapsed in the final prediction table.
Examples
# Create example prediction tables
observed = factor(sample(letters[1:2], 10, replace = TRUE))
predtab1 <- data.frame(.rownum = 1:10,
roinum = rep(1, 10),
observed = observed,
prob_A = runif(10),
prob_B = runif(10))
predtab2 <- data.frame(.rownum = 1:10,
roinum = rep(2, 10),
observed = observed,
prob_A = runif(10),
prob_B = runif(10))
# Combine the tables
combined_table <- combine_prediction_tables(list(predtab1, predtab2))
#> Warning: `funs()` was deprecated in dplyr 0.8.0.
#> ℹ Please use a list of either functions or lambdas:
#>
#> # Simple named list: list(mean = mean, median = median)
#>
#> # Auto named with `tibble::lst()`: tibble::lst(mean, median)
#>
#> # Using lambdas list(~ mean(., trim = .2), ~ median(., na.rm = TRUE))
#> ℹ The deprecated feature was likely used in the rMVPA package.
#> Please report the issue to the authors.