https://github.com/cran/bayestestR
Revision 40f7c88ddf855896018cf20ec8a7ac5fbd0ea2fb authored by Dominique Makowski on 27 January 2020, 05:30 UTC, committed by cran-robot on 27 January 2020, 05:30 UTC
1 parent d8462ad
Raw File
Tip revision: 40f7c88ddf855896018cf20ec8a7ac5fbd0ea2fb authored by Dominique Makowski on 27 January 2020, 05:30 UTC
version 0.5.1
Tip revision: 40f7c88
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