Description Usage Arguments Value Examples
Merge Multiple Data Frames
1 | merge_mult(..., f, by, suffixes)
|
... |
data frames to be merged or one list of all data frames to be merged |
f |
merge function, valid options are dplyr::inner_join, dplyr::left_join, dplyr::right_join, dplyr::full_join, dplyr::semi_join, dplyr::anti_join, base::merge (default options) |
by |
vector of shared column names to merge on or list of vectors where each element of list refers to the by value for the ith merge |
suffixes |
vector specifying suffixes to be used for making unique the names of columns in the result which are not used for merging |
A data frame
1 2 3 4 5 6 7 8 9 10 11 12 13 | # generate more random data
y1 <- data.frame(id = rep(1:5, 3), val = rnorm(15))
y2 <- data.frame(id = 1:15, id2 = rep(c("A", "B", "C"), 5), est = rnorm(15))
y3 <- data.frame(id = 1:15, id2 = rep(c("A", "B", "C"), 5), var = runif(15))
# merge by various attributes
merge_mult(y1, y2, y3, f = dplyr::inner_join, by = list("id", c("id", "id2")), suffixes = letters[1:3])
## Not run:
# equivalent to:
merge(y1, y2, by = "id") %>% merge(y3, by = c("id", "id2"))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.