mySplit: mySplit

Description Usage Arguments Value Examples

Description

Splits a string by a separator. Similar to strsplit, but returns a vector instead of a list. Works well for a single string, or for a vector if you include the index that you want returned.

Usage

1
2
mySplit(string, split, idx = NA, reverseIdx = FALSE, collapse = FALSE,
  ...)

Arguments

string

input character vector to split

split

the separator used to split string

idx

optional, indices of split string to return. Default returns the full split string

reverseIdx

if TRUE, reference indices from the end of the string. Default is FALSE

collapse

if TRUE and there are multiple indices, collapses all indices into 1 string using split. Default is FALSE

...

extra arguments passed to strsplit()

Value

character vector of split strings.

Examples

1
2
3
mySplit('This_That', '_')
mySplit('This_That', '_', 2)
mySplit('This_That_Another', '_', -1, reverseIdx = TRUE)

mnblonsky/REMI documentation built on May 23, 2019, 5:06 a.m.