Convert to factor and put NAs first

factorNAfirst(x)

Arguments

x

A vector.