Wrap text to a specified width, adding newlines for spaces if text exceeds the width

wrap_format(width)

Arguments

width

value above which to wrap

Value

Function with single parameter x, a character vector, that returns a wrapped character vector

Examples

wrap_10 <- wrap_format(10) wrap_10('A long line that needs to be wrapped')
#> [1] "A long\nline that\nneeds to\nbe\nwrapped"