https://github.com/cran/bayestestR
Raw File
Tip revision: 601edcd8d1306ebea478657861c54fa9c69a52f3 authored by Dominique Makowski on 31 May 2021, 05:40 UTC
version 0.10.0
Tip revision: 601edcd
as.list.R

# as.list -----------------------------------------------------------------

#' @export
as.list.bayestestR_hdi <- function(x, ...) {
  if (nrow(x) == 1) {
    out <- list(CI = x$CI, CI_low = x$CI_low, CI_high = x$CI_high)
    out$Parameter <- x$Parameter
  } else {
    out <- list()
    for (param in x$Parameter) {
      out[[param]] <- list()
      out[[param]][["CI"]] <- x[x$Parameter == param, "CI"]
      out[[param]][["CI_low"]] <- x[x$Parameter == param, "CI_low"]
      out[[param]][["CI_high"]] <- x[x$Parameter == param, "CI_high"]
    }
  }
  out
}

#' @export
as.list.bayestestR_eti <- as.list.bayestestR_hdi

#' @export
as.list.bayestestR_si <- as.list.bayestestR_hdi

#' @export
as.list.bayestestR_ci <- as.list.bayestestR_hdi
back to top