compare_observations: Compare Observations of Two Datasets

View source: R/compare_observations.R

compare_observationsR Documentation

Compare Observations of Two Datasets

Description

Performs row-by-row comparison of two datasets on common columns, identifying specific value differences at the cell level. Returns discrepancy counts and details showing which rows differ and how their values diverge.

Usage

compare_observations(df1, df2, tolerance = 0)

Arguments

df1

A data frame representing the first dataset.

df2

A data frame representing the second dataset.

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 containing discrepancy counts and details of row differences.

Examples


  df1 <- data.frame(id = 1:3, value = c(1.0, 2.0, 3.0))
  df2 <- data.frame(id = 1:3, value = c(1.0, 2.5, 3.0))
  compare_observations(df1, df2)
  compare_observations(df1, df2, tolerance = 0.00001)


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