Hi... I'm new to R. I've got a data frame with 170,000 observations and 69 variables. Some of these variables are strings that I would like to recode to numbers. But I don't want to be typing each string and a corresponding number. I'd rather just have R assign ascending numerical values to strings in alphabetical order for each variable.
Just as an example, if each observation is nested within 1 of the 50 US states and each state is in the data frame as a string. I'd like to create a new variable (e.g., 'state_numeric') such that Alabama = 1, Alaska = 2, Arizona = 3 etc., without having to type out each state name and each corresponding numeric value.
Any suggestions?
Thanks