Skip to contents

Split Vector by Index Subset

Usage

split_at(x, y = x, start, stop)

Arguments

x

<character> vector

y

<character> vector; default is x

start

<integer> index start

stop

<integer> index end

Value

<character> vector

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"
#>