t1o3ua
Last Updated: February 25, 2016
·
3.875K
· dionysios

Convert Factor to Vector in R

r

Surprisingly, there is no built-in command to convert a factor into a vector in R.
The following line will do the trick:

outputVector = as.numeric(levels(inputFactor)[as.integer(inputFactor)]