-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Labels
featurea feature request or enhancementa feature request or enhancement
Description
I am finding it a bit awkward to refactor code using plyr::mapvalues()
, which looks like:
mapvalues(x, from_vector, to_vector)
Items in x
found in from_vector
are replaced by the corresponding entry in to_vector
.
The closest analogue is case_match()
, but using it often requires pretty substantial refactoring, e.g. if from_vector
/to_vector
come from arguments to a function. Elsewhere it is often convenient to keep from_vector
/to_vector
instead of writing them out manually in different arguments.
Another approach I've tried would basically be to do a join-and-replace lookup with a left_join()
to tibble(from_vector, to_vector)
.
plyr::revalue()
is similarly not trivial to migrate.
Am I missing something else?
Metadata
Metadata
Assignees
Labels
featurea feature request or enhancementa feature request or enhancement