Skip to contents

Base-R replacement for diffdf::diffdf(). Matches base and compare rows on by, then compares every other shared column row-by-row with compare_values(). With by = NULL, rows are matched by position instead (matching diffdf::diffdf()'s own behavior when keys is unset).

Usage

diff_values_by_key(
  base,
  compare,
  by = NULL,
  tolerance = sqrt(.Machine$double.eps),
  scale = NULL,
  strict_factor = FALSE
)

Arguments

base

a data.frame or tibble

compare

a data.frame or tibble

by

character vector of shared key column(s), or NULL to match rows by position (base row 1 vs. compare row 1, etc.)

tolerance, scale, strict_factor

passed to compare_values()

Value

a list with diffs (long format: Variable name, by key column(s), Current Value, Previous Value), diffs_byvar (count of differing values per variable), and class_diffs (class mismatches by shared column)