Natural join is a join by identity on all common columns specified in the by
argument. Any common columns not specified in the by
argument are coalesced into a single column preferring the first or "a" table.
natural_join(a, b, ..., by, jointype = "INNER", env = parent.frame())Arguments a
source to select from.
bsource to select from.
...force later arguments to bind by name
bycharacter, set of columns to match. If by is a named character vector the right table will have columns renamed.
jointypetype of join ('INNER', 'LEFT', 'RIGHT', 'FULL').
envenvironment to look to.
Valuenatural_join node.
Examplesif(requireNamespace("DBI", quietly
= TRUE) && requireNamespace("RSQLite", quietly
= TRUE)) { my_db <- DBI::dbConnect(RSQLite::SQLite(),
":memory:") d1 <- rq_copy_to( my_db,
'd1',
build_frame( "key",
"val",
"val1" | "a",
1,
10 | "b",
2,
11 | "c",
3,
12 )) d2 <- rq_copy_to( my_db,
'd2',
build_frame( "key",
"val",
"val2" | "a",
5,
13 | "b",
6,
14 | "d",
7,
15 )) # key matching join optree <- natural_join(d1,
d2, jointype
= "LEFT", by
= 'key') execute(my_db,
optree) %.>% print(.) DBI::dbDisconnect(my_db) }#> key val val1 val2 #> 1 a 1 10 13 #> 2 b 2 11 14 #> 3 c 3 12 NA
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4