Split Vector by Index Subset
Examples
x <- c("0741T", "E0628", "L4387", "0360T", "1127F", "0002M")
(end <- sf_extract(x, "[A-Z]$"))
#> [1] "0741T" "0360T" "1127F" "0002M"
(beg <- paste0(take_at(end, 5), sf_remove(end, "[A-Z]$")))
#> [1] "T0741" "T0360" "F1127" "M0002"
split_at(x = end, y = beg, start = 1, stop = 2)
#> [[1]]
#> [1] "1127F"
#>
#> [[2]]
#> [1] "0002M"
#>
#> [[3]]
#> [1] "0741T" "0360T"
#>