Is there an alternative to “revalue” function from plyr when using dplyr?

后端 未结 4 1631
再見小時候
再見小時候 2021-02-18 15:57

I\'m a fan of the revalue function is plyr for substituting strings. It\'s simple and easy to remember.

However, I\'ve migrated new code to

4条回答
  •  我寻月下人不归
    2021-02-18 16:49

    One alternative that I find handy is the mapvalues function for the data.tables e.g

    df[, variable := mapvalues(variable, old = old_names_string_vector, new = new_names_string_vector)]
    

提交回复
热议问题