Nf: As Numeric Factor

View source: R/DescTools.r

NfR Documentation

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

Arguments

x

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

...

the dots are passed on to factor

Value

numeric vector

Author(s)

Andri Signorell <andri@signorell.net>

See Also

N

Examples

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

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

DescTools documentation built on Sept. 26, 2024, 1:07 a.m.