R/pValues.R

Defines functions pValue

Documented in pValue

#' @title
#' p-values.
#'
#' @description
#' Suppress the leading zero when printing p-values.
#'
#' @details
#' [INSERT].
#'
#' @param value The p-value.
#' @param digits Number of decimal digits for printing the p-value.
#'
#' @return p-value.
#'
#' @export
#'
#' @examples
#' pValue(0.70)
#' pValue(0.04)
#' pValue(0.00002)

pValue <- function(value, digits = 3){
  if(value < .001){
    newValue <- "< .001"
  } else {
    newValue <- paste("=", suppressLeadingZero(specify_decimal(value, digits)), sep = "")
  }
  return(newValue)
}

Try the petersenlab package in your browser

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

petersenlab documentation built on May 29, 2024, 8:34 a.m.