Added a function called relevelFactor.
This function does some dirty work regarding releveling for a factor, including trimming desired levels to only those present in the factor.