strsplit.wrap | R Documentation |
This function splits a string into substrings of length width
or shorter.
The splitting is done at the characters specified in split
, in order of preference.
strsplit.wrap(x, width = 2000, split = c("\n", " ", ",", ""))
x |
A character vector of length 1. |
width |
The maximum character length to break the vector at. |
split |
A vector of regular expressions to match a character to break the string at. The function will try to break the string at the first value specified in this argument; if that fails, it will move on to the second, then the third, etc. |
This combines the functionality of base::strwrap()
and base::strsplit()
;
instead of a string wrapped with newlines, the result is multiple substrings.
A character vector consisting of strings of length width
or shorter,
and split at the characters specified in split
.
Sercan Kahveci
thanks <- paste(readLines(file.path(R.home("doc"), "THANKS")), collapse = "\n")
strsplit.wrap(thanks,width=80)
alphabet <- paste0(letters,collapse="")
strsplit.wrap(alphabet,width=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.