genFactor function

Create factor variable from an existing (non-double) variable