getNthId.Rd
Extract feature names by splitting a given column by a separator and keeping the Nth entry.
getFirstId(df, colName, separator = ";")
getNthId(df, colName, N, separator = ";")
A vector with extracted feature identifiers.
df <- data.frame(x = c("g1;p1;h2", "g2;p1;h3"))
getFirstId(df, colName = "x", separator = ";")
#> [1] "g1" "g2"
getNthId(df, colName = "x", N = 2, separator = ";")
#> [1] "p1" "p1"
## Return value will be NA if the field doesn't exist
df <- data.frame(x = c("g1;p1;h2", "g2"))
getFirstId(df, colName = "x", separator = ";")
#> [1] "g1" "g2"
getNthId(df, colName = "x", N = 2, separator = ";")
#> [1] "p1" NA