Coercion functions for creating factors from other existing objects.
as.factor(x, ...)
as.ordered(x, ...)
A vector of data.
Other arguments passed on to methods.
For as.factor()
, a factor. For as.ordered()
,
an ordered factor.
These functions override non-generic factor coercion functions provided in base so that packages can provide methods for different data types. The default methods call the base versions.
as.factor(letters[1:5])
#> [1] a b c d e
#> Levels: a b c d e
as.ordered(letters[1:5])
#> [1] a b c d e
#> Levels: a < b < c < d < e