as_factor {forcats} | R Documentation |
Compared to base R, this function creates levels in the order in which they appear, which will be the same on every platform (base R sorts in the current locale which can vary from place to place).
as_factor(x, ...) ## S3 method for class 'factor' as_factor(x, ...) ## S3 method for class 'character' as_factor(x, ...)
x |
Object to coerce to a factor. |
... |
Other arguments passed down to method. |
This is a generic function.
x <- c("a", "z", "g") as_factor(x) as.factor(x)