to_factor function

Convert variables to factors