Learn R Programming

xfun (version 0.50)

str_wrap: Wrap character vectors

Description

A wrapper function to make strwrap() return a character vector of the same length as the input vector; each element of the output vector is a string formed by concatenating wrapped strings by \n.

Usage

str_wrap(...)

Value

A character vector.

Arguments

...

Arguments passed to strwrap().

Examples

Run this code
x = sample(c(letters, " "), 200, TRUE, c(rep(0.5/26, 26), 0.5))
x = rep(paste(x, collapse = ""), 2)
strwrap(x, width = 30)
xfun::str_wrap(x, width = 30)  # same length as x

Run the code above in your browser using DataLab