R/comma2.R

Defines functions comma2

Documented in comma2

#' @title Comma formatter
#' 
#' @description Per poder escollir entre el "." i la "," com a separador decimal. Útil en plots en versió en espanyol.
#' 
#' @param x a numeric vector to format
#' @param dec.mark The internal code respects the option getOption("OutDec") for the ‘decimal mark’, so if this is set to something other than "." then it takes precedence over argument decimal.mark.
#' @param ... other arguments passed on to format.
#' @return a function with single parameter x, a numeric vector, that returns a character vector.
#' @export
comma2 <- function(x, dec.mark = NULL, ...) {
  if(is.null(dec.mark)) dec.mark = getOption("OutDec")
  format(x, decimal.mark = dec.mark, trim = TRUE, scientific = FALSE, ...)
}
IRBLleida/UdBRpackage documentation built on Dec. 24, 2019, 9:10 p.m.