str_part: Split String and Return Part

Description Usage Arguments Value Author(s) See Also Examples

Description

Return the nth part of a splitted string.

Usage

1
2
3
str_part(x, split, n, ..., roll = F)

strpart(x, split, n, ..., roll = F)

Arguments

x

Character vector.

split

Regular expression splitting strings.

n

Number of part to extract.

...

Arguments passed to strsplit.

roll

Logical, if to use the last when less than maximum parts.

Value

A character vector of the extracted parts.

Author(s)

Sven E. Templer

See Also

strsplit

Examples

1
2
3
4
5
6
7
8
#

s <- c("abc","abcd","abc")

str_part(s, "", 4)
str_part(s, "", 4, roll=TRUE)

#

setempler/miscset documentation built on May 29, 2019, 8 p.m.