cat_wrap: Print to console, wrapping the text to a specific line width

View source: R/r_tools.R

cat_wrapR Documentation

Print to console, wrapping the text to a specific line width

Description

Wrapping console output is essential in Rmarkdown documents because long character vectors do not wrap when printed inside code blocks.

Usage

cat_wrap(text, width = 80, element_sep = "\n")

Arguments

text

(Character) A vector of text.

width

(Integer) The character length of each line.

element_sep

(Character) A string to insert between each element of text.

Value

Print to console.

Authors

Examples

vec <- c("This is a very long chunk of text.",
         "This is also another quite long chunk of text.")

cat_wrap(vec, width = 25)

#> This is a very long
#> chunk of text.
#>
#> This is also another
#> quite long chunk of
#> text.


DesiQuintans/desiderata documentation built on April 9, 2023, 5:43 a.m.