Skip to contents

CRAN_Status_Badge Downloads Code Coverage đź“”

diffdf compares two data.frame objects and provides a detailed summary of any differences that were found between them. The package has it’s origins in supporting QC workflows for product development within the pharmaceutical industry aiming at being a light weight alternative to SAS’s PROC COMPARE.

Currently diffdf supports the following:

  • Checking for differences in:
    • Values
    • Attributes
    • Classes
    • Column names
    • Number of observations
    • Column ordering
  • Matching rows by key/id variables
  • Fuzzy comparisons (i.e. treating doubles and integers as the same)
  • Extracting datasets of different rows

For more information on features please consult the vignette and man pages.

Alternatives

If diffdf isn’t quite right for your use case then the following are other packages that provide similar functionality that may be more appropriate:

Installation

You can install the released version of diffdf from CRAN with:

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("gowerc/diffdf")

Example

library(diffdf)
iris2 <- iris
for (i in 1:3) iris2[i,i] <- i^2
iris2$new_var <- "hello"
class(iris2$Species) <- "some class"
diffdf(iris, iris2)