https://github.com/cran/bayestestR
Tip revision: 428249f43a9c6fd0c425b28deb5fee51a9525d69 authored by Dominique Makowski on 18 September 2022, 01:46:03 UTC
version 0.13.0
version 0.13.0
Tip revision: 428249f
utils_posterior.R
# helper ------------------------------
.posterior_draws_to_df <- function(x) {
UseMethod(".posterior_draws_to_df")
}
.posterior_draws_to_df.default <- function(x) {
stop(paste0("Objects of class `%s` are not yet supported.", class(x)[1]), call. = FALSE)
}
.posterior_draws_to_df.data.frame <- function(x) {
x
}
.posterior_draws_to_df.draws_df <- function(x) {
insight::check_if_installed("posterior")
datawizard::data_remove(as.data.frame(posterior::as_draws_df(x)), c(".chain", ".iteration", ".draw"))
}
.posterior_draws_to_df.draws_matrix <- .posterior_draws_to_df.draws_df
.posterior_draws_to_df.draws_array <- .posterior_draws_to_df.draws_df
.posterior_draws_to_df.draws_list <- .posterior_draws_to_df.draws_df
.posterior_draws_to_df.draws_rvars <- .posterior_draws_to_df.draws_df
.posterior_draws_to_df.rvar <- .posterior_draws_to_df.draws_df