R/paste.round.R

pasteRound <- function (..., digits=16, sep=" ", collapse=NULL) {
  args <- list(...)
  if (length(args) == 0)
    if (length(collapse) == 0)
      character(0)
    else ""
  else{
    for (i in seq_along(args))
      if (is.numeric(args[[i]])) args[[i]] <-
               as.character(round(args[[i]], digits))
      else args[[i]] <- as.character(args[[i]])
   paste(args, sep, collapse)
  }
} # pasteRound

Try the cwhmisc package in your browser

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

cwhmisc documentation built on May 1, 2019, 7:55 p.m.