check_factors function

Check factor levels