To use it and return data.frame with one column:
mtcars %>% transmute(cyl = plyr::mapvalues(cyl, c(4, 6, 8), c("a", "b", "c")))
Or, if you want one vector output, as in your working example, use pull :
mtcars %>% pull(cyl) %>% plyr::mapvalues(., c(4, 6, 8), c("a", "b", "c"))
If you are using both dplyr and plyr at the same time, see this note in the readme dplyr file :
You need to be a little more careful if you download both plyr and dplyr at the same time. I would recommend loading plyr first, then dplyr, so that the faster dplyr functions are first in the search path. In general, any function provided by both dplyr and plyr works the same way, although dplyr functions are generally faster and more general.
Note that you can invoke mapvalues using plyr::mapvalues if dplyr is loaded without having to load plyr.
Sam firke
source share