Given a pattern, it splits and returns the slot of interest.

ss(x, pattern, slot = 1, ...)

Arguments

x

Passed to argument x of strsplit.

pattern

Passed to argument split of strsplit.

slot

An integer specifying which element of the resulting list to return.

...

Additional arguments passed to strsplit.

Value

A vector with the information extracted from x.

Author

Andrew E Jaffe

Examples


## Some example info with two variables separated by a _
info <- c("DLPFC_polyA", "DLPFC_RiboZero")
ss(info, "_", 1)
#> [1] "DLPFC" "DLPFC"
ss(info, "_", 2)
#> [1] "polyA"    "RiboZero"

## Example where we use the ... argument
ss("a.b.c", ".", slot = 1, fixed = TRUE)
#> [1] "a"