plyr::mapvalues
can be used like this:
mapvalues(mtcars$cyl, c(4, 6, 8), c("a", "b", "c"))
But this doesn't work:
mtcars %>%
dplyr::select(cyl) %>%
mapvalues(c(4, 6, 8), c("a", "b", "c")) %>%
as.data.frame()
How can I use plyr::mapvalues
with dplyr
? Or even better, what the dplyr
equivalent?