str_part {miscset}R Documentation

Split String and Return Part

Description

Return the nth part of a splitted string.

Usage

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

#

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

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

#

[Package miscset version 1.1.0 Index]