Hello everyone,
I am trying to use recode_factor to convert a string to a factor.
I am unable to see what basic mistake I am making which is throwing this error.
> answer <- tbl(con,"mytable") %>% head %>% select(EDUCATION)
> answer
# Source: lazy query [?? x 1]
# Database: mysql 10.3.25-MariaDB-0+deb10u1
EDUCATION
<chr>
1 5th Std. Pass
2 No Education
3 8th Std. Pass
4 8th Std. Pass
5 11th Std. Pass
6 9th Std. Pass
> answer <- tbl(con,"mytable") %>% head %>%
+ mutate(edu = recode_factor(EDUCATION,
+ "No Education" = "None or Primary",
+ "1st Std. Pass" = "None or Primary",
+ "2nd Std. Pass" = "None or Primary",
+ "3rd Std. Pass" = "None or Primary",
+ "4th Std. Pass" = "None or Primary",
+ "5th Std. Pass" = "None or Primary",
+ "6th Std. Pass" = "Class 10",
+ "7th Std. Pass" = "Class 10",
+ "8th Std. Pass" = "Class 10",
+ "9th Std. Pass" = "Class 10",
+ "10th Std. Pass" = "Class 10",
+ "11th Std. Pass" = "Class 12 / Diploma",
+ "12th Std. Pass" = "Class 12 / Diploma",
+ .default = "Graduate and Above",
+ .ordered = TRUE
+ ))
> answer
Error in .local(conn, statement, ...) :
could not run statement: Incorrect parameters in the call to stored function 'recode_factor'
In addition: Warning message:
Named arguments ignored for SQL recode_factor
>