'How do you reorder categories on R using fct_recode()

I keep trying to reorder my variables using this function:

ces2019 <- mutate(ces2019,vote_intention = fct_recode(vote_intention,"Certain Not to vote" = "(4) Certain not to vote","Unlikely" = "(3) Unlikely","Likely" = "(2) Likely", "Certain"="(1) Certain","Already voted in advanced poll"= "(5) Already voted in advanced poll") )

However I keep getting this error:

Problem with `mutate()` column `vote_intention`. ℹ `vote_intention = fct_recode(...)`. ℹ Unknown levels in `f`: (4) Certain not to vote, (3) Unlikely, (2) Likely, (1) Certain 

also whenever I then do levels(ces2019$vote_intention) I keep getting Null

Thank you in advance!!!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source