Converts a factor to a numeric vector with integers 1, 2, ... for the levels.
as.numfac(factor)
factor
A numeric vector.
x <- as.numfac(treats)