File: format.R

package info (click to toggle)
r-cran-performance 0.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,860 kB
  • sloc: sh: 13; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 901 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#' @export
format.compare_performance <- function(x, digits = 2, ...) {
  # if we have ranking, add score and remove incomplete indices in print
  if ("Performance_Score" %in% colnames(x)) {
    x$Performance_Score <- insight::format_value(x$Performance_Score, as_percent = TRUE)
    x <- x[!sapply(x, anyNA)]
  }

  # format weighted ICs
  weighted_ics <- endsWith(colnames(x), "_wt")
  if (any(weighted_ics)) {
    x[weighted_ics] <- lapply(
      x[weighted_ics],
      insight::format_bf,
      name = NULL,
      exact = TRUE
    )
  }

  if ("BF" %in% colnames(x)) {
    x$BF[is.na(x$BF)] <- 1
    # x$BF <- insight::format_bf(x$BF, exact = TRUE)
  }
  insight::format_table(x, digits = digits, ...)
}


#' @export
format.performance_model <- function(x, digits = 2, ...) {
  # format p-values for meta-analysis
  insight::format_table(x, digits = digits, ...)
}