I web scraped 50 states from a website and added them to my data set under the name "state_name", I need to correspond all the state values 1 with Alabama all state values 2 with Alaska, etc...
Asked
Active
Viewed 56 times
-1
-
FYI it’s __scraped__ not scrapped – DisappointedByUnaccountableMod May 10 '21 at 21:08
2 Answers
0
You can try
df$state_value <- as.integer(factor(df$state_name))
or
df$state_value <- match(df$state_name,unique(df$state_name))

ThomasIsCoding
- 96,636
- 9
- 24
- 81