text_wrap {unitizer}R Documentation

Text Wrapping Utilities

Description

Functions to break up character vector components to a specified width.

Usage

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()
)

Arguments

x

character vector

width

what width to wrap at

tolerance

how much earlier than width we're allowed to wrap

hyphens

whether to allow hyphenation

unlist

logical(1L) if FALSE each element in x is returned as an element of a list, otherwise one character vector is returned

Details

Newlines are replaced by empty strings in the output so that each character vector in the output represents a line of screen output.

Value

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


[Package unitizer version 1.4.12 Index]