Description Usage Arguments Examples
This function splits the given column in the data.frame
1 |
vec |
a vector of char objects |
sep |
character containing regular expression(s) (unless fixed = TRUE) to use for splitting. |
part |
the part of the split to return, when 0 returns all. defaults to 0. |
fixed |
logical. If TRUE match split exactly, otherwise use regular expressions. defaults to FALSE. |
fill |
logical. fill with NA when needed. defaults to TRUE. |
1 2 3 4 5 6 7 | splitText('hello2all4of222you', '\\d+') # a vector ('hello','all', 'of', 'you')
splitText('hello.all.of.you', '.', fixed=TRUE) # same as above
splitText('hello-all-of-you', '-') # same as above
splitText('hello-all-of-you', '-', 2) # 'all'
splitText(c('all-2', 'any-3', 'never-4'), '-') # a data.frame with 2 columns
splitText(c('all-2', 'any-3', 'never-4-d'), '-') # The third column will be NA for the first two rows
splitText(c('all-2', 'any-3', 'never-4'), '-', 1) # a vector c('all', 'any', 'never')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.