https://github.com/cran/bayestestR
Raw File
Tip revision: 2565fc870cd7f0a64d857ff89e682dc9344dc7c1 authored by Dominique Makowski on 12 February 2020, 04:10 UTC
version 0.5.2
Tip revision: 2565fc8
print.p_significance.R
#' @export
print.p_significance <- function(x, digits = 2, ...) {
  if ("data_plot" %in% class(x)) {
    print(as.data.frame(x))
  } else if ("data.frame" %in% class(x)) {
    .print_ps(x, digits, ...)
  } else {
    cat(sprintf(
      "ps [%s] = %s%%",
      insight::format_value(attributes(x)$threshold, digits = digits),
      insight::format_value(x * 100, digits = digits)
    ))
  }
}

#' @keywords internal
.print_ps <- function(x, digits, ...) {
  insight::print_color(sprintf(
    "# Probability of Significance (ps [%s])\n\n",
    insight::format_value(attributes(x)$threshold, digits = digits)
  ), "blue")
  x$Parameter <- as.character(x$Parameter)
  x$ps <- sprintf("%s%%", insight::format_value(x$ps * 100, digits = digits))
  print_data_frame(x, digits = digits)
}
back to top