Learn R Programming

rquery (version 0.2.0)

natural_join: Make a natural_join node.

Description

Natural join is a join by identity on all common columns (or only common columns specified in a non-NULL by argument). Any common columns not specified in a non-NULL by argument are coalesced.

Usage

natural_join(a, b, ..., jointype = "INNER", by = NULL)

Arguments

a

source to select from.

b

source to select from.

...

force later arguments to bind by name

jointype

type of join ('INNER', 'LEFT', 'RIGHT', 'FULL').

by

set of columns to match.

Value

natural_join node.

Examples

Run this code
# NOT RUN {
my_db <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
d1 <- dbi_copy_to(my_db, 'd1',
                 data.frame(AUC = 0.6, R2 = 0.2, D = NA))
d2 <- dbi_copy_to(my_db, 'd2',
                 data.frame(AUC = 0.6, D = 0.3))
eqn <- natural_join(d1, d2, by = 'AUC')
cat(format(eqn))
sql <- to_sql(eqn, my_db)
cat(sql)
DBI::dbGetQuery(my_db, sql)
DBI::dbDisconnect(my_db)

# }

Run the code above in your browser using DataLab