I am releveling a dataset with following code:
library(dplyr)
library(forcats)
df <- df %>%
mutate(component = fct_relevel(component, levels = '1','2','3','4'))
This works totally fine in my laptop. It was working on my computer as well, but I tried installing some packages (not sure ) and it stopped working. When I run it on my computer, it shows error as reported below:
Error in mutate()
:
ℹ In argument: component = fct_relevel(component, levels = "1", "2", "3", "4")
.
Caused by error in fct_relevel()
:
! Arguments in ...
must be passed by position, not name.
✖ Problematic argument:
• levels = “1”
Run rlang::last_trace()
to see where the error occurred.
What could be potential source of error?
I tried uninstalling and reinstalling R and R studio but it did not work.
Chirayu Kothari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2