The function temporarily converts a vector or vector column in a data.frame
to a character vector, and then loops through the ‘old’ vector
looking for values to replace with the respective value in the ‘new’
vector. The column is then converted back to a factor.