as.numeric.factor: Convert a factor to numeric.vector.

Description Usage Arguments Details Value Author(s) Examples

Description

Internal function which will drop unused levels and convert remaining to a number from 1 to n levels.

Usage

1
as.numeric.factor(x,drop.levels=TRUE)

Arguments

x

noramlly a factor, can be a numeric vector(will be outputted unchanged)

drop.levels

booleen, should unused levels be droppped?

Details

simple internal function

Value

a vector of same length, where each category/level is replaced with number from 1 to n

Author(s)

Soren Havelund Welling

Examples

1
2
3
as.numeric.factor = forestFloor:::as.numeric.factor #import to environment
some.factor = factor(c("dog","cat","monkey")[c(1,3,2,1,3,2,1,1)]) #make factor
a.numeric.vector = as.numeric.factor(some.factor) #convert factor representation.

forestFloor documentation built on May 2, 2019, 4:46 p.m.