I am new to R and trying to translate ordinal variables into numerical values. I have a variable named "Founders_previous_company_employee_count" that has 3 different entries as inputs - ("Small", "Medium", "Large"), which I write to 1,2,3 values ββrespectively. I tried using the realue function from the plyr package using the code below
startupfull$employee_count_code<-as.numeric(revalue(startupfull$Founders_previous_company_employee_count,c("Small"=1, "Medium"=2, "Large"=3)))
which works great. However, I am trying to use the recode function in the dplyr package, I am getting an error.
The code:
startupfull$prevcomp_empcount_code <- as.numeric(recode(startupfull$Founders_previous_company_employee_count,c("Small"=1, "Medium"=2, "Large"=3)))
Error - error: all replacements must be named
What am I doing wrong here?
source
share