File: format_df_adjust.R

package info (click to toggle)
r-cran-parameters 0.24.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,852 kB
  • sloc: sh: 16; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 1,007 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
33
34
35
#' Format the name of the degrees-of-freedom adjustment methods
#'
#' Format the name of the degrees-of-freedom adjustment methods.
#'
#' @param method Name of the method.
#' @param approx_string,dof_string Suffix added to the name of the method in
#'   the returned string.
#'
#' @examples
#' library(parameters)
#'
#' format_df_adjust("kenward")
#' format_df_adjust("kenward", approx_string = "", dof_string = " DoF")
#' @return A formatted string.
#' @export
format_df_adjust <- function(method,
                             approx_string = "-approximated",
                             dof_string = " degrees of freedom") {
  method <- tolower(method)

  out <- switch(method,
    kr = ,
    `kenward-rogers` = ,
    `kenward-roger` = ,
    kenward = "Kenward-Roger",
    ml1 = "m-l-1",
    betwithin = ,
    bw = "Between-within",
    fit = "Residual",
    boot = "Bootstrapped",
    insight::format_capitalize(method)
  )

  paste0(out, approx_string, dof_string)
}