R/label_wrap_mod.r

#' Wrap label text.
#' 
#' @param value vector (converted using \code{\link{as.character}}) to be wrapped.
#' @param width the maximum width of each line in characters.
#' 
#' Adapted from https://github.com/hadley/ggplot2/wiki/labeller
label_wrap_mod <- function(value, width = 25) {
  sapply(strwrap(as.character(value), width=width, simplify=FALSE), 
         paste, collapse="\n")
}
bryanmayer/likert_custom documentation built on May 13, 2019, 8:10 a.m.