I tried to categorize a numerical vector by using as_factor()
as_factor(c(1, 2, 3))
The error hapeend.
Error in UseMethod("as_factor") : no applicable method for 'as_factor' applied to an object of class "c('double', 'numeric')"
But it works when comes to as.factor()
as.factor(c(1, 2, 3))
[1] 1 2 3
Levels: 1 2 3
I tried to categorize a numerical vector by using as_factor()
as_factor(c(1, 2, 3))The error hapeend.
But it works when comes to as.factor()
as.factor(c(1, 2, 3))[1] 1 2 3Levels: 1 2 3