dm (version 0.2.8)

dm_join_to_tbl: Join two tables

Description

A join of a desired type is performed between table_1 and table_2. The two tables need to be directly connected by a foreign key relation. Since this function is a wrapper around dm_flatten_to_tbl(), the LHS of the join will always be a "child table", i.e. a table referencing the other table.

Usage

dm_join_to_tbl(dm, table_1, table_2, join = left_join)

Arguments

dm

A dm object.

table_1

One of the tables involved in the join.

table_2

The second table of the join.

join

The type of join to be performed, see dplyr::join().

Value

The resulting table of the join.

See Also

Other flattening functions: dm_flatten_to_tbl()

Examples

Run this code
# NOT RUN {
dm_nycflights13() %>%
  dm_join_to_tbl(airports, flights)

# same result is achieved with:
dm_nycflights13() %>%
  dm_join_to_tbl(flights, airports)

# this gives an error, because the tables are not directly linked to each other:
try(
  dm_nycflights13() %>%
    dm_join_to_tbl(airlines, airports)
)
# }

Run the code above in your browser using DataLab