|
47 | 47 |
|
48 | 48 | When the \code{on} argument is missing, it will be determined based \code{how} argument: |
49 | 49 | \enumerate{ |
50 | | - \item{ When \code{how \%in\% c("left", right", "semi", "anti")}, \code{on} becomes the key columns of the \emph{join-to} table. } |
51 | | - \item{ When \code{how \%in\% c("inner", full")}, if only one table has key, then this key is used; if both tables have keys, then \code{on = intersect(key(lhs), key(rhs))}, having its order aligned to shorter key. } |
| 50 | + \item{ When \code{how \%in\% c("left", right", "semi", "anti")}, \code{on} becomes the key column(s) of the \emph{join-to} table. } |
| 51 | + \item{ When \code{how \%in\% c("inner", full")}, 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 shorter key. } |
52 | 52 | } |
53 | 53 |
|
54 | 54 | When joining tables that are not directly linked to a single table, e.g. a snowflake schema, a \emph{right} outer join can be used to optimize the sequence of merges, see Examples. |
@@ -106,8 +106,8 @@ l = list( |
106 | 106 | data.table(id1=c(2:3, 2L), v2=1:3), ## dups in RHS |
107 | 107 | data.table(id1=3:5, v3=1:3) |
108 | 108 | ) |
109 | | -#mergelist(l, on="id1") # ERROR: mult='error' and multiple matches during merge |
110 | 109 | lapply(l[-1L], `[`, j = if (.N>1L) .SD, by = "id1") ## duplicated rows |
| 110 | +try(mergelist(l, on="id1")) |
111 | 111 |
|
112 | 112 | ## 'star schema' and 'snowflake schema' examples |
113 | 113 |
|
|
0 commit comments