Description Usage Arguments Value See Also Examples
Split up a string in pieces and return the nth piece.
| 1 | 
| x | character vector to be split. | 
| split | regular expression used for splitting. | 
| n | Vector of elements to be returned. | 
| from | One of ‘start’ or ‘end’. From which direction do we count the pieces. | 
| collapse | an optional character string to separate the results. | 
| ... | Arguments passed on to  | 
A character vector.
Other string-utils: blanks,
dup, pad,
replace_ext, split_path,
strip_ext, trim,
wrap
| 1 2 3 4 5 6 7 8 9 10 11 12 13 | str <- c("Lorem, ipsum, dolor", "consectetur, adipisicing, elit")
strsplitN(str, ", ", 1)
## [1] "Lorem"
## [2] "consectetur"
strsplitN(str, ", ", 1, from="end")
## [1] "dolor"
## [2] "elit"
strsplitN(str, ", ", 1:2)
## [1] "Lorem, ipsum"
## [2] "consectetur, adipisicing"
strsplitN(str, ", ", 1:2, collapse = "--")
## [1] "Lorem--ipsum"
## [2] "consectetur--adipisicing"
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.