I have a dataset as follows;
My_data <- tibble(ref = 1:3, codes = c(12204, 35478, 67456))
I want to separate the codes column as follows.
The first digit of the codes column forms a new variable clouds.
The second and third digits of the codes column forms a new variable wind_direction.
The last two digits of the codes column form a new variable wind_speed.
NB: I know that str_match and str_match_all can do this. The problem is that they return a matrix. I want a solution that will extend the tibble to include the three additional variables.
Thank you.