R/label_wrap_mod.r

Defines functions label_wrap_mod

Documented in label_wrap_mod

#' 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")
}
jbryer/likert documentation built on July 29, 2022, 3:42 p.m.