Extract information from strings. This is done by splitting the string by one or multiple delimiters. The split results are wrapped in a data.frame. Optionally, one can pass column names and/or types for the parts. E.g. types="cir" converts the first part into character, the second into integer and the third into real/double.

str_explode(x, split, names = NULL, types = NULL)

explode(x, split, names = NULL, types = NULL)

Arguments

x

[character]
Character vector.

split

[character(1)]
See parameter split of strsplit.

names

[character]
Optional column names. If NULL, the column names are explode1 to explodeN where N is the number of split parts.

types

[character(1)]
Character string where the i-th character specifies the atomic data type of the i-th split part. Possible characters are “'c'” (character), “'f'” (factor), dQuote'i' (integer), “'l'” (logical) or “n”, “d” or “r” for numeric/double/real. Default is NULL. In this case all split parts are characters.

Value

A data frame.

See also

Other string helpers: str_parse(), str_to_shortcut()