I have a data frame df
in the following form: The element data type is character.
Well and Depth
Black Peak 1000
Black Peak 1001
Black Peak 1002
Black Peak 10150
Black Peak 10151
I'd like to extract this data into two parts: The first being the last number in the string, and all the text before the space right in front of the number. Also, when the number is extracted, how would I be able to turn the character into a usable integer? I intend on taking the extracted data and leaving it in the data frame. It would look like the following after completion:
Well Depth
Black Peak 1000
Black Peak 1001
Black Peak 1002
Black Peak 10150
Black Peak 10151
The two lists above would be two columns in the data frame df
Data
Using base R
Or using a
tidyverse
approach