Split up a string into pieces and extract the results using a specific index position. Mathematically, you can interpret it as follows:
Given a character string, S, extract the element at a given position, k, from the result of splitting S by a given pattern, m.
Examples
code <- c("HS-IB-EDE", "OG-OYO-CAS-0121", "NY-ILR-NIG-036")
str_split_extract(code, "-", 1)
#> [1] "HS" "OG" "NY"
str_split_extract(code, "-", 4)
#> [1] NA "0121" "036"
