Reputation: 3590
I have a tricky problem. I have a factor where the labels of the factor are numbers. I want to collapse several levels into one and keep the other levels intact
I tried
fct_collapse(factor(c(1,3,6,9)),
`1` = "1",
`3` = "3",
group_other = "3+")
But I get this error.
Error in if (group_other) { : argument is not interpretable as logical
I tried putting the levels on the left side in quotations but same error.
Any help much appreciated
Upvotes: 0
Views: 246
Reputation: 887941
The group_other
is deprecated, perhaps use other_level
library(forcats)
fct_collapse(factor(c(1,3,6,9)),
`1` = "1",
`3` = "3",
other_level = "3+")
[1] 1 3 3+ 3+
Levels: 1 3 3+
Upvotes: 2