R/format_df_adjust.R

Defines functions format_df_adjust

Documented in format_df_adjust

#' 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)
}

Try the parameters package in your browser

Any scripts or data that you put into this service are public.

parameters documentation built on Nov. 2, 2023, 6:13 p.m.