In the following example
x <- data.frame(code = 7:9, food = c(\'banana\', \'apple\', \'popcorn\'))
y <- data.frame(food = c(\'banana\', \'apple\', \'po
If you only bring in one column and want to append it last then maybe merge
is overkill and you can just do an assingment with a match
-[
indexing approach:
> x$isfruit <- y$isfruit[match(y$food, x$food)]
> x
code food isfruit
1 7 banana fruit
2 8 apple fruit
3 9 popcorn not fruit
(There are no switches to throw in the merge function to do what you ask.)