f2n: factor to numeric

Description Usage Arguments Details Value Examples

View source: R/f2n.R

Description

If you ever have a factor where the levels do not correspond with the defaults in R i.e (1,2) this will convert back into what they originally are. It is useful when you'd like to treat the factor as a vector (as in using it with cbind, etc.)

Usage

1
f2n(x)

Arguments

x

an object of class factor

Details

This function converts it into a character string and then into the numeric

Value

the ORIGINAL numbering of your factors

Examples

1
2
3
my_factor=factor(c(5,6,5,6),levels=c(5,6))
cbind(my_factor)
f2n(my_factor)

nkbxwb/berlineR documentation built on May 23, 2019, 9:05 p.m.