View source: R/summarize_draws.R
summarize_draws | R Documentation |
Helper function to summarize a matrix or data.frame of predictive draws
summarize_draws(
draws,
id_fields = NULL,
draw_fields = NULL,
ui_width = 0.95,
na.rm = TRUE
)
draws |
A |
id_fields |
(default NULL) Only considered for data.frame-like |
draw_fields |
(default NULL) Only considered for data.frame-like |
ui_width |
( |
na.rm |
( |
A data.table::data.table containing at least the following fields:
The id_fields
, if passed
"mean": Mean across predictive draws
"lower": Lower bound of the (X%) uncertainty interval
"upper": Upper bound of the (X%) uncertainty interval
"ui_width": "upper" - "lower"
# Summarize a draws matrix
draws_matrix <- matrix(rnorm(200), nrow = 10)
summary_table_a <- summarize_draws(draws_matrix)
head(summary_table_a)
# Summarize a draws data.table with location IDs
draws_table <- matrix(c(1:10, rnorm(200)), nrow = 10) |>
data.table::as.data.table() |>
data.table::setnames(c('location_id', paste0('draw_', 1:20)))
summary_table_b <- summarize_draws(draws_table, id_fields = 'location_id')
head(summary_table_b)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.