Insert line breaks in long character strings. Useful if you want to wordwrap labels / titles for plots or tables.
word_wrap(labels, wrap, linesep = NULL)
labels | Label(s) as character string, where a line break should be inserted. Several strings may be passed as vector (see 'Examples'). |
---|---|
wrap | Maximum amount of chars per line (i.e. line length). If |
linesep | By default, this argument is |
New label(s) with line breaks inserted at every wrap
's position.
word_wrap(c("A very long string", "And another even longer string!"), 10)#> [1] "A very\nlong\nstring" "And\nanother\neven\nlonger\nstring!"message(word_wrap("Much too long string for just one line!", 15))#>#> #>