Learn R Programming

strs (version 0.1.0)

strs_split: Split string into substrings

Description

strs_split splits each element of a character vector into substrings based on a separator. It is similar to Python's str.split() method.

Usage

strs_split(string, sep = " ", maxsplit = -1L)

Value

A list of character vectors, with each vector containing the split substrings from the corresponding element of string.

Arguments

string

A character vector to split.

sep

The separator on which to split the string.

maxsplit

The maximum number of splits to perform. If -1, all possible splits are performed.

See Also

Examples

Run this code
strs_split("hello world", " ")
strs_split("one,two,three", ",", maxsplit = 1)

Run the code above in your browser using DataLab