as_factor function

Convert variable into factor and keep value labels