I need to replace values in the Nth column of my df, call these values v1s, by some other values from anothe df, call them v2s. There is a dictionary, or ruther two dictionaries. The first one translates v1s into numbers, the second one translates the numbers into v2s. I tried merge(), left/right_join(), smth else...but nothing seems to work. Can somebody help please?
Asked
Active
Viewed 29 times
0
-
Does this answer your question? [Canonical tidyverse method to update some values of a vector from a look-up table](https://stackoverflow.com/questions/67081496/canonical-tidyverse-method-to-update-some-values-of-a-vector-from-a-look-up-tabl) – jared_mamrot Jul 18 '22 at 10:26
-
Thank you. It is usefull. I managed to do the trick by inner_join() – agozar Jul 23 '22 at 13:50
1 Answers
0
Merging the datasets should work. Try the code until you can make it work.
Otherwise, you can always simply add an extra column to your dataset with
datasetA$newvar <- datasetB$v2s
when you have correctly added the second variable, simply drop the first.

Davide Bertoli
- 11
- 3