emend_fct_reorder function

Reorder the levels of the input factor in a meaningful way.