forcats (version 0.2.0)

as_factor: Convert input to a factor.

Description

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).

Usage

as_factor(x, ...)
"as_factor"(x, ...)
"as_factor"(x, ...)

Arguments

x
Object to coerce to a factor.
...
Other arguments passed down to method.

Details

This is a generic function.

Examples

Run this code
x <- c("a", "z", "g")
as_factor(x)
as.factor(x)

Run the code above in your browser using DataLab