Last Updated: February 25, 2016
·
13.52K
· dionysios

Convert Factor to Vector in 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)]