Convert factor to numeric vector

Share:

Description

Converts the factor labels to a vector of numeric vectors

Usage

1

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

1
2
3
4
5
6
m1 <- matrix(rep(1, 16), 4)
m2 <- matrix(c(1, 0, .5, .5, 0, 1, .5, .5, .5, .5, 1, .5, .5, .5, .5, 1), 4)
m3 <- matrix(c(1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), 4)
cmd(m1, m1)
cmd(m1, m2)
cmd(m2, m3)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.