R/createMessage.R

Defines functions createMessage

Documented in createMessage

createMessage <- function(x, width.cutoff=45, default='x', collapse='; ', 
                          endchars='...'){
  if(sum(nchar(x))<1){
    x <- default 
  } 
  x. <- paste(x, collapse=collapse)
  nchx <- nchar(x.)
  maxch <- (width.cutoff-nchar(endchars))
  if(nchx>maxch){
    x2 <- substring(x., 1, maxch)
    x. <- paste0(x2, endchars)
  }
  x. 
}

Try the Ecfun package in your browser

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

Ecfun documentation built on May 2, 2019, 6:53 p.m.