Internal function to match rows between two datasets using specified key variables, then compare values on matched rows. Also identifies unmatched rows in either dataset.
compare_observations_by_id(df1, df2, id_vars, common_cols, tolerance = 0)A list with:
List with discrepancies and details (same
structure as compare_observations() output), plus id_details containing
the ID variable values for each difference
List with df1_only and df2_only data frames
First data frame (base).
Second data frame (compare).
Character vector of ID column names.
Character vector of common column names.
Numeric tolerance value for floating-point comparisons (default 0). When tolerance > 0, numeric values are considered equal if their absolute difference is within the tolerance threshold. Character and factor columns always use exact matching regardless of tolerance.