Learn R Programming

DescTools (version 0.99.52)

Nf: As Numeric Factor

Description

Encode a vector x to a factor and then to a numeric value. It's a simple shortcut for as.numeric(factor(x, ...))

Usage

Nf(x, ...)

Value

numeric vector

Arguments

x

a vector of data, usually taking a small number of distinct values.

...

the dots are passed on to factor

Author

Andri Signorell <andri@signorell.net>

See Also

N

Examples

Run this code
x <- LETTERS[10:15]
Nf(x)

# same as ..
as.numeric(factor(x))

Run the code above in your browser using DataLab