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 April 6, 2018, 3:10 p.m.