Learn R Programming

clinCompare (version 1.0.0)

compare_observations: 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)

Value

A list containing discrepancy counts and details of row differences.

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.

Examples

Run this code
# \donttest{
  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)
# }

Run the code above in your browser using DataLab