Description Usage Details Value Author(s) Examples
A wrapper function for the base function merge
. Inherits all arguments from merge
and provides an additional flag column labeled _merge
. smerge
also outputs counts of matched and unmatched observations from each data frame. Refer to merge
for argument descriptions.
1 2 3 |
Unlike merge
, smerge
defaults to all = TRUE
. The numeric codes for the merge column are also different from those used in STATA. -1 and 1 denote unmatched observations from x
and y
respectively. 0 denotes a matched observation
A data frame formed by merging x
and y
with an additional column labeled _merge
Sven Halvorson (svenedmail@gmail.com)
1 2 3 4 5 6 7 8 9 10 11 12 | test1 = data.frame(letter = c("A","A","B","C","D"),
num = 1:5,
pork = c("bacon","carnitas","carnitas","ham","chops"))
test2 = data.frame(letter = c("B","C","E","A"),
num = c(2,3,4,2),
chicken = c("wings","sammich","fried","drumstick"))
smerge(test1,test2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.