Convert a factor with numeric levels to a non-factor (numeric).

factornum(x)

Arguments

x

A vector containing a factor with numeric levels.

Value

The input factor made into a numeric vector.

Examples

x <- factor(c(3, 4, 9, 4, 9), levels = c(3, 4, 9)) factornum(x)
#> [1] 3 4 9 4 9
#