Description Usage Arguments Details Value Author(s) See Also Examples
A verbose wrapper for the merge
function from the base
package.
1 2 3 4 5 |
x, y |
data frames, or objects to be coerced to one. |
by, by.x, by.y |
specifications of the columns used for merging. |
all |
logical; |
all.x |
logical; if TRUE, then extra rows will be added to the output, one for each row in x that has no matching row in y. These rows will have NAs in those columns that are usually filled with values from y. The default is FALSE, so that only rows with data from both x and y are included in the output. |
all.y |
logical; analogous to |
verbose |
prints information about the merge. See 'Details'. |
... |
additional arguments passed to |
This function is just a wrapper for merge
, the behavior and the return value are the same.
Calculation of the printed information is not computationaly free; mergeV
takes significantly longer than the non verbose version to compute. Cross joins have almost no overhead, and inner joins have less overhead than the other types of junctions.
When verbose
is FALSE the computational overhead is removed.
The printed information is composed of 3 parts. The first part represents the number of lines from each entry tables X and Y who have matches, and the number of resulting lines in the output R. The second part gives the type of join (inner, outer, left, right and cross). The last part is only there if there is a by
variable, and gives the number of nXn matches on the by variables.
Same value as merge
.
Antoine Filipovic Pierucci
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # classical merge example
authors <- data.frame(
surname = I(c("Tukey", "Venables", "Tierney", "Ripley", "McNeil")),
nationality = c("US", "Australia", "US", "UK", "Australia"),
deceased = c("yes", rep("no", 4)))
books <- data.frame(
name = I(c("Tukey", "Venables", "Tierney",
"Ripley", "Ripley", "McNeil", "R Core")),
title = c("Exploratory Data Analysis",
"Modern Applied Statistics ...",
"LISP-STAT",
"Spatial Statistics", "Stochastic Simulation",
"Interactive Data Analysis",
"An Introduction to R"),
other.author = c(NA, "Ripley", NA, NA, NA, NA,
"Venables & Smith"))
mergeV(authors, books, by.x = "surname", by.y = "name")
mergeV(authors, books, by.x = "surname", by.y = "name", all = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.