R/roundp.R

Defines functions roundp

Documented in roundp

#' Funció per arrodonir valors p
#' 
#' @param x numerical. Any p-value.
#' @param digits integer indicating the number of decimal places.
#' @return Rounded p-value.
#' @export
roundp <- function(x, digits = 3){
  lb <- 10^{-digits}
  ub <- 1 - 10^{-digits}
  p.rounded <- ifelse(x < lb, paste0("<", lb), ifelse(x > ub, paste0(">", ub), round(x = x, digits = digits)))
  return(p.rounded)
} 
IRBLleida/UdBRpackage documentation built on Dec. 24, 2019, 9:10 p.m.