info_join: Provides information about rows matching for dplyr join verbs

Description Usage Arguments Details Examples

View source: R/general.R

Description

Provides verbose information about rows matching when joining dataframes using dplyr join verbs. It prints a summary of the number of rows in x that have no match in y, rows in x that have only one match in y and rows in x that have more than one match in y.

Usage

1
info_join(x, y, ...)

Arguments

x,

y tbls to join.

...

Any argument admitted by the join verbs of dplyr.

Details

info_join admits the same arguments as the join verbs (left_join, inner_join, full_join, anti_join and semi_join) in dplyr, and prints a summary of rows matching: the number of rows in x that have no match in y, rows in x that have only one match in y and rows in x that have more than one match in y, and symmetrically for the rows in y with no, one, or more than one match in x.

It is useful to anticipate the results of the join action, in particular to control the dimension of the output dataframe. It allows, for example, to prevent unvoluntary mistakes upon joining x and y, when the user may be unaware of duplicated rows matching in y which results in more rows than in $x$.

Examples

1
2
3
4
5
6
##  Picking the second example from the Two-table-verbs vignette in
## dplyr.
library("dplyr")
df1 <- data_frame(x = c(1, 2), y = 2:1)
df2 <- data_frame(x = c(1, 3), a = 10, b = "a")
info_join(df1, df2)

mkesslerct/opadar documentation built on May 23, 2019, 2:01 a.m.