-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
  • 96,636
  • 9
  • 24
  • 81
Abc
  • 1
  • 1

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,580
  • 1
  • 13
  • 40