fac2num: Convert factor to numeric vector

View source: R/fac2num.R

fac2numR Documentation

Convert factor to numeric vector

Description

Converts the factor labels to numeric values and returns the factor as a numeric vector

Usage

fac2num(x)

Arguments

x

A factor

Details

Returns a vector of numeric values. Elements in the input factor that cannot be converted to numeric will produce NA.

Value

Returns a numeric vector of the same length as x

Author(s)

Claus Ekstrom claus@rprimer.dk

Examples


f <- factor(c(1,2,1,3,2,1,2,3,1))
fac2num(f)


MESS documentation built on Aug. 21, 2023, 1:05 a.m.

Related to fac2num in MESS...