library(tidyverse)
# toy data
df <- tibble(x = c("1500000 5kkkkk22222", "000 abcde bb11111"))
df
#> # A tibble: 2 x 1
#> x
#> <chr>
#> 1 1500000 5kkkkk22222
#> 2 000 abcde bb11111
How can create new variables from x by specifying positions?
For example, I want to create the following variables: a: position 1 b: position 3 c: position 12 d: position 18
> df_desired
# A tibble: 2 x 4
a b c d
<chr> <chr> <chr> <chr>
1 15 "00000 " 5kkkkk 22222
2 5k "0 abcd" e bb 11111