bm_factor function

Mapper for factor variables