Description Usage Arguments Details Value Author(s) See Also Examples
Merges variables from two data frames (DataX, DataY) by default or merges cases (if AddVars= FALSE). When mergeing variables, by default matches on row names but can use other variable names in DataX (ByX) and DataY (ByY) as needed. Also by default, includes all cases in DataX and DataY but can limit to only matching (AllX=FALSE, AllY=FALSE) or left join (AllY=FALSE) or right join (AllX=FALSE).
When merging cases, will add variables to DataX or DataY as needed and set added variables to NA
1 |
DataX |
first data frame for merge |
DataY |
second data frame for merge |
ByX |
Name of variable in DataX to match cases on. Column can be specified by name or number. Default is 0 which uses rownames |
ByY |
Name of variable in DataY to match cases on. Column can be specified by name or number. Default is 0 which uses rownames |
AllX |
logical; if TRUE, then extra rows will be added to the output, one for each row in DataX that has no matching row in DataY These rows will have NAs in those columns that are usually filled with values from dY. The default is TRUE, so that all rows with data from both dX and dY are included in the output. In other words, it is the union of these two dataframes |
AllY |
analagous to AllX but for DataY |
AddVars |
Default is to merge variables (columns). If FALSE will merge cases (rows) |
see merge() or rbind() for more details on merging variables or cases, respectively.
Returns merged data frame
John J. Curtin jjcurtin@wisc.edu
merge(), rbind()
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.