Functions to break up character vector components to a specified width.
text_wrap(x, width)word_wrap(x, width = getOption("width"), tolerance = 8L, hyphens = TRUE,
unlist = TRUE, collapse = NULL)
meta_word_cat(..., sep = "\n", width = getOption("width"),
tolerance = 8L, file = stdout(), trail.nl = TRUE)
meta_word_msg(..., sep = "\n", width = getOption("width"),
tolerance = 8L, trail.nl = TRUE)
word_cat(..., sep = " ", width = getOption("width"), tolerance = 8L,
file = stdout())
word_msg(...)
word_comment(x, width = getOption("width"), tolerance = 8L,
hyphens = TRUE, unlist = TRUE, color = crayon::has_color())
character vector
what width to wrap at
how much earlier than width
we're allowed to wrap
whether to allow hyphenation
logical(1L) if FALSE each element in x
is returned as
an element of a list, otherwise one character vector is returned
a list with, for each item in x
, a character vector
of the item wrapped to length width
if unlist
is a parameter, then a character vector, or
if not or if unlist
is FALSE, a list with each element from x
corresponding to an element from the list
text_wrap
breaks each element to a specified width
,
where width
can contain different values for each value in
x
word_wrap
wraps at whitespace, or crudely hyphenates if
necessary; note that unlike text_wrap
width
must be scalar
word_cat
is like word_wrap
, except it outputs to screen
word_msg
is like word_cat
, except it ouputs to stderr
meta_word_cat
is like word_cat
, except it wraps output
in formatting to highlight this is not normal output
Newlines are replaced by empty strings in the output so that each character vector in the output represents a line of screen output.