I am trying to separate a column in a rather messy frame.
section
View 500
V458
453
And I want to create a new column from this. With preferred output as shown below.
section section numbers
View 500
V 458
453
I tried to explore it, but I have time with it. I can separate them in the case of the first line, because I can use a regular expression like this.
df_split <- separate(df, col = section, into = c("section", "section_number"), sep = " +[1-9]")
But I canβt find a way to use a type operator or. If anyone has any input that would be great.
source
share