-2

I am looking to divide this into two variables. Ideally, I would have one variable with just the items, and another with just the numbers. Of course, deleting the intermittent periods is the biggest challenge I face. Anyone have any tips? Thanks in advance.

R Dataframe

ThomasIsCoding
  • 80,151
  • 7
  • 17
  • 65

1 Answers1

1

look at stringr package and the str_match function. Something like

library(stringr)
str_match(df$V1,"([\\w ]+)[,]+([0-9.]+)")

You will need to learn some regex. I cannot test my answer, as you don't provide data in your post. Please paste the output of dput(your_df) in your post

denis
  • 5,142
  • 1
  • 10
  • 36