compare_observations_by_id: Compare Observations by ID Variables

View source: R/cdisc_validate.R

compare_observations_by_idR Documentation

Compare Observations by ID Variables

Description

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.

Usage

compare_observations_by_id(df1, df2, id_vars, common_cols, tolerance = 0)

Arguments

df1

First data frame (base).

df2

Second data frame (compare).

id_vars

Character vector of ID column names.

common_cols

Character vector of common column names.

tolerance

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.

Value

A list with:

observation_comparison

List with discrepancies and details (same structure as compare_observations() output), plus id_details containing the ID variable values for each difference

unmatched_rows

List with df1_only and df2_only data frames


clinCompare documentation built on Feb. 19, 2026, 1:07 a.m.