Learn R Programming

versus (version 0.3.1)

slice_unmatched: Get rows in only one table

Description

Get rows in only one table

Usage

slice_unmatched(comparison, table)

slice_unmatched_both(comparison)

Value

slice_unmatched()

The table identified by table is filtered to the rows comparison shows as not appearing in the other table

slice_unmatched_both()

The output of slice_unmatched() for both input tables row-stacked with a column table indicating which table the row is from. The output contains only columns present in both tables.

Arguments

comparison

The output of compare()

table

A string matching one of the identifiers supplied via table_id when calling compare() (defaults are "a" and "b"). Within the comparison, these identifiers are stored in comparison$tables$table.

Examples

Run this code
comp <- compare(example_df_a, example_df_b, by = car)
comp |> slice_unmatched("a")
comp |> slice_unmatched("b")

# slice_unmatched(comp, "a") output is the same as
example_df_a |> dplyr::anti_join(example_df_b, by = comp$by$column)

comp <- compare(example_df_a, example_df_b, by = car, table_id = c("old", "new"))
comp |> slice_unmatched("old")

comp |> slice_unmatched_both()

Run the code above in your browser using DataLab