Learn R Programming

keyed (version 0.1.3)

compare_keys: Compare key values between two data frames

Description

Identifies keys that are new, removed, or common between two keyed data frames. Does not compare values, only key membership.

Usage

compare_keys(x, y, by = NULL)

Value

A key comparison object.

Arguments

x

First keyed data frame.

y

Second keyed data frame.

by

Column(s) to compare. If NULL, uses the key from x.

Examples

Run this code
df1 <- key(data.frame(id = 1:3, x = 1:3), id)
df2 <- key(data.frame(id = 2:4, x = 2:4), id)
compare_keys(df1, df2)

Run the code above in your browser using DataLab