R/label_wrap_mod.r

Defines functions label_wrap_mod

Documented in label_wrap_mod

#' Wrap label text.
#' 
#' @param value vector (converted using [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 June 13, 2025, 7:56 p.m.