|
37 | 37 | \enumerate{ |
38 | 38 | \item{ \code{how \%in\% c("left", "semi", "anti")}: \emph{join-from} is \emph{LHS}, \emph{join-to} is \emph{RHS}. } |
39 | 39 | \item{ \code{how == "right"}: \emph{join-from} is \emph{RHS}, \emph{join-to} is \emph{LHS}. } |
40 | | - \item{ \code{how \%in\% c("inner", "full")}: \emph{LHS} and \emph{RHS} are treated equally, so that each is both \emph{join-from} and \emph{join-to}. } |
| 40 | + \item{ \code{how \%in\% c("inner", "full")}: \emph{LHS} and \emph{RHS} are treated symmetrically, so that each is both \emph{join-from} and \emph{join-to}; see below. } |
41 | 41 | \item{ \code{how == "cross"}: \code{mult} must be \code{"all"} and \code{on} is not used, so the terms are not relevant. } |
42 | 42 | } |
43 | 43 |
|
| 44 | + In Case 3, the symmetry is as follows: |
| 45 | + \itemize{ |
| 46 | + \item{ When \code{mult \%in\% c("first", "last", "error")}, then (respectively) the first, last, or only matching row on each side binds with the same on the other. \code{mult} is satisfied mutually and the merge is one-to-one. } |
| 47 | + \item{ If only one table has a key, then this key is used; if both tables have keys, then \code{on = intersect(key(lhs), key(rhs))}, having its order aligned to the shorter key. } |
| 48 | + } |
| 49 | + |
44 | 50 | Using \code{mult="error"} will throw an error when a row in the \emph{join-from} table finds multiple matching rows in the \emph{join-to} table. It should not be used just to detect duplicates in \emph{join-to}, as these might not have a matching row in \emph{join-from}, and thus silently be missed. |
45 | 51 |
|
46 | 52 | When not specified, \code{mult} takes its default depending on the \code{how} argument: |
|
50 | 56 | \item{ When \code{how == "cross"}, \code{mult="all"}. } |
51 | 57 | } |
52 | 58 |
|
53 | | - Symmetrical \emph{join-from}/\emph{join-to} treatment of \emph{LHS} and \emph{RHS} when \code{how \%in\% c("inner", "full")} is as follows: |
54 | | - \itemize{ |
55 | | - \item{ When \code{mult \%in\% c("first", "last", "error")}, then (respectively) the first, last, or only matching row on each side binds with the same on the other (and hence the merge is one-to-one). } |
56 | | - \item{ If only one table has a key, then this key is used; if both tables have keys, then \code{on = intersect(key(lhs), key(rhs))}, having its order aligned to the shorter key. } |
57 | | - } |
58 | | - |
59 | 59 | When joining tables that are not directly linked to a single table, e.g. a snowflake schema (see References), a \emph{right} outer join can be used to optimize the sequence of merges, see Examples. |
60 | 60 | } |
61 | 61 | \value{ |
|
0 commit comments