as.numeric.lfactor: Numeric Vectors from lfactors

Description Usage Arguments Details See Also Examples

Description

Returns numeric representation of an lfactor equal to the levels argument for each value. This is different from the behavior of factor which would ignore the values of level.

Usage

1
2
## S3 method for class 'lfactor'
as.numeric(x, ...)

Arguments

x

same as as.numeric

...

not used

Details

This method does not return floating point (numeric) results that are otherwise equal to the results from as.integer.lfactor. Instead it returns the value of the level that was input when the lfactor was created.

See Also

as.numeric, as.integer.lfactor

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
require(lfactors)
# create an example
let <- lfactor(4:12,
               levels=4:12,
               labels=letters[4:12])

as.numeric(let)
#same as as.numeric(4:12)
as.integer(let)
#same as 1:9

lfactors documentation built on May 2, 2019, 8:29 a.m.