Learn R Programming

generics (version 0.1.4)

coercion-factor: Factor coercion

Description

Coercion functions for creating factors from other existing objects.

Usage

as.factor(x, ...)

as.ordered(x, ...)

Value

For as.factor(), a factor. For as.ordered(), an ordered factor.

Arguments

x

A vector of data.

...

Other arguments passed on to methods.

Methods

as.factor()

generics:::methods_rd("as.factor")

as.ordered()

generics:::methods_rd("as.ordered")

Details

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.

Examples

Run this code
as.factor(letters[1:5])
as.ordered(letters[1:5])

Run the code above in your browser using DataLab