mergeDF | R Documentation |
..
mergeDF(
x,
table,
by = character(),
by.x = character(),
by.table = character(),
...
)
x |
data.frame, on which new columns will be added.
All rows of |
table |
data.frame, columns of which will be added to |
by |
character scalar or vector |
by.x , by.table |
character scalar or vector |
... |
additional parameters of matchDF |
Function mergeDF returns a data.frame.
We avoid merge.data.frame as much as possible,
because it's slow and
even sort = FALSE
may not completely retain the original order of input x
.
# examples inspired by ?merge.data.frame
(authors = data.frame(
surname = c('Tukey', 'Venables', 'Tierney', 'Ripley', 'McNeil'),
nationality = c('US', 'Australia', 'US', 'UK', 'Australia'),
deceased = c('yes', rep('no', 4))))
(books = data.frame(
name = c('Tukey', 'Venables', 'Tierney', 'Ripley',
'Ripley', 'McNeil', 'R Core', 'Diggle'),
title = c(
'Exploratory Data Analysis',
'Modern Applied Statistics',
'LISP-STAT', 'Spatial Statistics', 'Stochastic Simulation',
'Interactive Data Analysis', 'An Introduction to R',
'Analysis of Longitudinal Data'),
other.author = c(
NA, 'Ripley', NA, NA, NA, NA, 'Venables & Smith',
'Heagerty & Liang & Scott Zeger')))
(m = mergeDF(books, authors, by.x = 'name', by.table = 'surname'))
attr(m, 'nomatch')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.