fac2num function

Convert factor to numeric vector

Convert factor to numeric vector

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

fac2num(x)

Arguments

  • x: A factor

Returns

Returns a numeric vector of the same length as x

Details

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

Examples

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

Author(s)

Claus Ekstrom claus@rprimer.dk

  • Maintainer: Claus Thorn Ekstrøm
  • License: GPL-2
  • Last published: 2023-08-20