powered by
Compares two data frames row-by-row using the key from x to align rows. Identifies added, removed, and modified rows, with cell-level detail for modifications.
x
# S3 method for keyed_df diff(x, y, ...)
A keyed_diff object with fields:
keyed_diff
key_cols: character vector of key column names
key_cols
n_removed, n_added, n_modified, n_unchanged: counts
n_removed
n_added
n_modified
n_unchanged
removed: data frame of rows in x not in y
removed
y
added: data frame of rows in y not in x
added
changes: named list of per-column change tibbles (each with key columns, old, and new)
changes
old
new
cols_only_x, cols_only_y: columns present in only one side
cols_only_x
cols_only_y
A keyed data frame (the "old" or "reference" state).
A data frame (the "new" state). Must contain the key columns from x.
Ignored (present for S3 compatibility with base::diff()).
base::diff()
old <- key(data.frame(id = 1:3, x = c("a", "b", "c")), id) new <- data.frame(id = 2:4, x = c("B", "c", "d")) diff(old, new)
Run the code above in your browser using DataLab