powered by
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)
Label(s) as character string, where a line break should be inserted. Several strings may be passed as vector (see 'Examples').
Maximum amount of chars per line (i.e. line length). If wrap = Inf or wrap = 0, no word wrap will be performed (i.e. labels will be returned as is).
wrap = Inf
wrap = 0
labels
By default, this argument is NULL and a regular new line string ("\n") is used. For HTML-purposes, for instance, linesep could be "<br>".
NULL
"\n"
linesep
"<br>"
New label(s) with line breaks inserted at every wrap's position.
wrap
# NOT RUN { word_wrap(c("A very long string", "And another even longer string!"), 10) message(word_wrap("Much too long string for just one line!", 15)) # }
Run the code above in your browser using DataLab