wrap_string | R Documentation |
Core wrapping functionality that preserves whitespace. Newline character "\n"
is not supported
by core functionality stringi::stri_wrap()
. This is usually solved beforehand by matrix_form()
.
If the width is smaller than any large word, these will be truncated after width
characters. If
the split leaves trailing groups of empty spaces, they will be dropped.
wrap_string(str, width, collapse = NULL, fontspec = font_spec())
wrap_txt(str, width, collapse = NULL, fontspec = font_spec())
str |
( |
width |
( |
collapse |
( |
fontspec |
( |
Word wrapping happens similarly to stringi::stri_wrap()
with the following difference: individual
words which are longer than max_width
are broken up in a way that fits with other word wrapping.
A string if str
is one element and if collapse = NULL
. Otherwise, a list of elements
(if length(str) > 1
) that can contain strings or vectors of characters (if collapse = NULL
).
wrap_txt()
: Deprecated function. Please use wrap_string()
instead.
str <- list(
" , something really \\tnot very good", # \t needs to be escaped
" but I keep it12 "
)
wrap_string(str, 5, collapse = "\n")
wrap_txt(str, 5, collapse = NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.