## ----vignette-nowrap-options, include = FALSE, eval = TRUE----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
options(width = 10000)
## ----setup, include = FALSE-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
message = FALSE,
warning = FALSE
)
tick <- '✓'
limited <- 'limited'
no <- 'No'
na_cell <- 'n/a'
model_columns <- c(
"brma.norm", "brma.glmm", "bselmodel", "bPET/bPEESE",
"BMA.norm", "BMA.glmm", "RoBMA"
)
reference_links <- c(
"add_loo()" = "../reference/add_loo.brma.html",
"add_marglik()" = "../reference/add_marglik.brma.html",
"add_waic()" = "../reference/add_waic.brma.html",
"as_draws()" = "../reference/as_draws.brma.html",
"as_draws_array()" = "../reference/as_draws.brma.html",
"as_draws_df()" = "../reference/as_draws.brma.html",
"as_draws_list()" = "../reference/as_draws.brma.html",
"as_draws_matrix()" = "../reference/as_draws.brma.html",
"as_draws_rvars()" = "../reference/as_draws.brma.html",
"as_zplot()" = "../reference/as_zplot.brma.html",
"bayes_factor()" = "../reference/bf.brma.html",
"bf()" = "../reference/bf.brma.html",
"blup()" = "../reference/blup.brma.html",
"bPET()" = "../reference/bPET.html",
"bPEESE()" = "../reference/bPEESE.html",
"brma()" = "../reference/brma.html",
"brma.glmm()" = "../reference/brma.glmm.html",
"BMA()" = "../reference/BMA.html",
"BMA.glmm()" = "../reference/BMA.glmm.html",
"bridge_sampler()" = "../reference/bridge_sampler.brma.html",
"bselmodel()" = "../reference/bselmodel.html",
"check_loo()" = "../reference/check_loo.brma.html",
"coef()" = "../reference/coef.brma.html",
"contr.meandif()" = "../reference/contr.BayesTools.html",
"contr.orthonormal()" = "../reference/contr.BayesTools.html",
"contr.treatment()" = "https://stat.ethz.ch/R-manual/R-devel/library/stats/html/contrast.html",
"cooks.distance()" = "../reference/cooks.distance.brma.html",
"covratio()" = "../reference/covratio.brma.html",
"dfbetas()" = "../reference/dfbetas.brma.html",
"dffits()" = "../reference/dffits.brma.html",
"estimate_unit_information_sd()" = "../reference/estimate_unit_information_sd.html",
"fitted()" = "../reference/fitted.brma.html",
"funnel()" = "../reference/funnel.html",
"galbraith()" = "../reference/radial.html",
"hatvalues()" = "../reference/hatvalues.brma.html",
"influence()" = "../reference/influence.brma.html",
"interpret()" = "../reference/interpret.html",
"logLik()" = "../reference/logLik.brma.html",
"logml()" = "../reference/logml.brma.html",
"loo()" = "../reference/loo.brma.html",
"loo::pareto_k_ids()" = "https://mc-stan.org/loo/reference/pareto-k-diagnostic.html",
"loo::pareto_k_table()" = "https://mc-stan.org/loo/reference/pareto-k-diagnostic.html",
"loo_compare()" = "../reference/loo_compare.brma.html",
"loo_weights()" = "../reference/loo_weights.brma.html",
"marginal_means()" = "../reference/marginal_means.brma.html",
"nobs()" = "../reference/nobs.brma.html",
"plot()" = "../reference/plot.brma.html",
"plot_diagnostic()" = "../reference/plot_diagnostic.html",
"plot_diagnostic_autocorrelation()" = "../reference/plot_diagnostic.html",
"plot_diagnostic_density()" = "../reference/plot_diagnostic.html",
"plot_diagnostic_trace()" = "../reference/plot_diagnostic.html",
"plot_pet_peese()" = "../reference/plot_pet_peese.html",
"plot_prior()" = "../reference/plot_prior.html",
"plot_weightfunction()" = "../reference/plot_weightfunction.html",
"pooled_effect()" = "../reference/pooled_effect.brma.html",
"pooled_heterogeneity()" = "../reference/pooled_heterogeneity.brma.html",
"post_prob()" = "../reference/post_prob.brma.html",
"predict()" = "../reference/predict.brma.html",
"print_prior()" = "../reference/print_prior.html",
"prior()" = "../reference/prior.html",
"prior_factor()" = "../reference/prior_factor.html",
"prior_informed()" = "../reference/prior_informed.html",
"prior_none()" = "../reference/prior_none.html",
"prior_PEESE()" = "../reference/prior_PEESE.html",
"prior_PET()" = "../reference/prior_PET.html",
"prior_weightfunction()" = "../reference/prior_weightfunction.html",
"qqnorm()" = "../reference/qqnorm.brma.html",
"radial()" = "../reference/radial.html",
"ranef()" = "../reference/ranef.brma.html",
"regplot()" = "../reference/regplot.html",
"residuals()" = "../reference/residuals.brma.html",
"RoBMA()" = "../reference/RoBMA.html",
"rstandard()" = "../reference/rstandard.brma.html",
"rstudent()" = "../reference/rstudent.brma.html",
"simulate()" = "https://stat.ethz.ch/R-manual/R-devel/library/stats/html/simulate.html",
"summary()" = "../reference/summary.brma.html",
"summary_heterogeneity()" = "../reference/summary_heterogeneity.brma.html",
"summary_models()" = "../reference/summary_models.html",
"true_effects()" = "../reference/true_effects.brma.html",
"update()" = "../reference/update.brma.html",
"vcov()" = "https://stat.ethz.ch/R-manual/R-devel/library/stats/html/vcov.html",
"vif()" = "../reference/vif.brma.html",
"waic()" = "../reference/waic.brma.html",
"weights()" = "https://stat.ethz.ch/R-manual/R-devel/library/stats/html/weights.html",
"wf_cumulative()" = "../reference/prior_weightfunction.html",
"wf_fixed()" = "../reference/prior_weightfunction.html",
"wf_independent()" = "../reference/prior_weightfunction.html",
"forest()" = "https://wviechtb.github.io/metafor/reference/forest.rma.html",
"baujat()" = "https://wviechtb.github.io/metafor/reference/baujat.html",
"gosh()" = "https://wviechtb.github.io/metafor/reference/gosh.html",
"labbe()" = "https://wviechtb.github.io/metafor/reference/labbe.html"
)
model_column_links <- list(
"brma.norm" = "../reference/brma.html",
"brma.glmm" = "../reference/brma.glmm.html",
"bselmodel" = "../reference/bselmodel.html",
"bPET/bPEESE" = c("../reference/bPET.html", "../reference/bPEESE.html"),
"BMA.norm" = "../reference/BMA.html",
"BMA.glmm" = "../reference/BMA.glmm.html",
"RoBMA" = "../reference/RoBMA.html"
)
status_map <- c(
Y = tick,
L = limited,
N = no,
A = na_cell
)
feature_row <- function(topic, feature, pattern) {
values <- strsplit(pattern, "", fixed = TRUE)[[1]]
if (length(values) != length(model_columns)) {
stop("Status pattern has wrong length: ", pattern, call. = FALSE)
}
out <- c(
list(Topic = topic, Feature = feature),
stats::setNames(as.list(status_map[values]), model_columns)
)
return(out)
}
feature_table <- function(rows) {
rows <- as.data.frame(do.call(rbind, rows), stringsAsFactors = FALSE, check.names = FALSE)
rows[] <- lapply(rows, function(x) {
if (is.list(x)) {
return(vapply(x, function(y) paste0(as.character(y), collapse = ""), character(1)))
}
return(as.character(x))
})
cat('
')
escape_html_text <- function(x) {
x <- as.character(x)
x <- gsub("&", "&", x, fixed = TRUE)
x <- gsub("<", "<", x, fixed = TRUE)
x <- gsub(">", ">", x, fixed = TRUE)
x <- gsub('"', """, x, fixed = TRUE)
return(x)
}
format_code_span <- function(code) {
code_html <- paste0("", escape_html_text(code), "")
link <- if (code %in% names(reference_links)) reference_links[[code]] else NA_character_
if (!is.na(link)) {
return(paste0('', code_html, ""))
}
return(code_html)
}
escape_html <- function(x) {
x <- as.character(x)
matches <- gregexpr("`[^`]+`", x, perl = TRUE)[[1]]
if (matches[1] == -1L) {
return(escape_html_text(x))
}
match_lengths <- attr(matches, "match.length")
pieces <- character(0)
position <- 1L
for (j in seq_along(matches)) {
match_start <- matches[j]
match_end <- match_start + match_lengths[j] - 1L
if (match_start > position) {
pieces <- c(pieces, escape_html_text(substr(x, position, match_start - 1L)))
}
code <- substr(x, match_start + 1L, match_end - 1L)
pieces <- c(pieces, format_code_span(code))
position <- match_end + 1L
}
if (position <= nchar(x)) {
pieces <- c(pieces, escape_html_text(substr(x, position, nchar(x))))
}
return(paste0(pieces, collapse = ""))
}
format_model_column <- function(model_column) {
link <- model_column_links[[model_column]]
if (length(link) == 2L) {
return(paste0(
'bPET/',
'bPEESE'
))
}
return(paste0(
'',
escape_html_text(model_column),
""
))
}
topic_runs <- rle(rows$Topic)
topic_start <- cumsum(c(1L, head(topic_runs$lengths, -1L)))
topic_span <- rep(0L, nrow(rows))
topic_span[topic_start] <- topic_runs$lengths
cat('
| Topic | ') cat('Feature | ') for (model_column in model_columns) { cat('', format_model_column(model_column), " | ", sep = "") } cat("
|---|---|---|
| ', escape_html(rows$Topic[i]), " | ", sep = "" ) } cat('', escape_html(rows$Feature[i]), " | ", sep = "") for (model_column in model_columns) { cat('', rows[[model_column]][i], " | ", sep = "") } cat("