str_explode: Split strings into parts of certain types

View source: R/str_explode.R

str_explodeR Documentation

Split strings into parts of certain types

Description

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.

Usage

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), “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.


jakobbossek/re documentation built on Nov. 15, 2024, 1:42 a.m.