emend_fct_match function

Match input factor to specified levels.