Diffs for R Objects

Generate a colorized diff of two R objects for an intuitive visualization of their differences.

Generate a colorized diff of two R objects for an intuitive visualization of their differences.

See vignettes for details, and for comparisons with standard comparison functions.


If your terminal supports formatting through ANSI escape sequences, diffobj will output colored diffs to the terminal. Otherwise, output will be colored with HTML/CSS and sent to the IDE viewport or to your browser. diffobj comes with several built-in color schemes that can be further customized. Some examples:

Output Examples


This package is available on CRAN.


Related Software


  • R Core for developing and maintaining such a wonderful language.
  • CRAN maintainers, for patiently shepherding packages onto CRAN and maintaining the repository, and Uwe Ligges in particular for maintaining Winbuilder.
  • Eugene W. Myers for the Diff algorithm.
  • Michael B Allen for the original C implementation of the Myers' Diff algorithm.
  • Jim Hester because covr rocks.
  • Dirk Eddelbuettel and Carl Boettiger for the rocker project, and Gábor Csárdi and the R-consortium for Rhub, without which testing bugs on R-devel and other platforms would be a nightmare.
  • Tomas Kalibera for rchk and rcnst to help detect errors in compiled code.
  • Hadley Wickham for devtools and roxygen2.
  • Yihui Xie for knitr and J.J. Allaire etal for rmarkdown, and by extension John MacFarlane for pandoc.
  • All open source developers out there that make their work freely available for others to use.
  • Github, Travis-CI, Codecov, Vagrant, Docker, Ubuntu, Brew for providing infrastructure that greatly simplifies open source development.
  • Free Software Foundation for developing the GPL license and promotion of the free software movement.




  • Fix test failures caused by changes in tibble output



  • Fix tests for next testthat release.
  • #107: Diffs on quoted language
  • #108: Problems caused by copying crayon functions (@seulki-choi, @gaborcsardi)
  • #100: R_useDynamicSymbols
  • #97: 2D Guidelines fixes for data.table, tibble
  • #96: Warnings when comparing large data tables.
  • #94: Guide detection problems in nested lists.
  • #105: Copyright tweaks.


  • #87: diffobj is now GPL (>=2) instead of GPL-3.
  • #81: Better handling of mixed UTF-8 / ASCII strings, reported by jennybc
  • #88: correctly handle trimming when empty lists are involved, reported by wch
  • #77: diffObj now favors dispatching to diffPrint unless diffPrint output is large
  • #82: diffChr and ses now treat NA as "NA" (needed with change in nchar(NA) in base R)
  • #85: Improved alignment of unwrapped atomic vector diffs
  • #83: Improve pager auto detection (note now ANSI output is only allowed by default if terminal supports ANSI colors and the system pager is less, see ?Pager for details)
  • #92, #80, #45: basic implementation of S4 guidelines and trimming (full resolution eventually with #33)
  • #84: simplify how to call diffChr for improved performance, including "optimization" of convert.hz.whitespace.
  • #64: fix line limit in corner case
  • More robust handling of external diff* methods and of how diffObj calls diffStr and diffPrint


  • #71: Buggy diffs b/w data frames when one has sequential row numbers and the other does not, loosely related to #38
  • #69: Improve performance on outputs with large print/show output, and other assorted minor optimizations
  • #72: Warn when style parameter overrides other user supplied parameters
  • #70: Improve word contrast in YB HTML mode
  • #63: Show all.equal output when objects are not all.equal but there are no visible differences
  • Add Mean Relative Indifference vignette and update vignette styling


  • #67: Fix CRAN Binaries
  • Clarified that C code is heavily modified and incompatible with original libmba implementation


  • First version on CRAN
  • #51: use RStudio viewport to display HTML diffs when running in RStudio, as per Noam Ross
  • #54: #55, scale HTML output to viewport width (see ?Style)
  • #53: default term colors computed on run instead of on package load
  • #56: disable wrap for HTML output
  • HTML output now captured with default width 80 since there is no explicit relationship between HTML viewport width and getOption("width")
  • The style parameter now accepts lists to use as instantiation arguments for Style objects (see ?Style)
  • Fix subtle rendering and formatting application flaws
  • Switch Travis shields to SVG per Gábor Csárdi
  • Improve in-hunk alignment of partially matching lines
  • Compile with -pedantic, fix related warnings Arun
  • Improved coverage and more robust testing
  • Several internal structure changes to accommodate improvements


  • #46: Guide and Trim Problems with Lists
  • #47: Output Format in non-ANSI Terminals Without Browser (reported by Frank)
  • #48: make_blocking Default prompt Confusing (reported by Frank)
  • #49: In-Hunk Word Diffs Issues when Unwrap-diffing Atomics
  • #50: CSS Lost in Rstudio Server Sessions (reported by Steven Beaupré)


  • Turn off unwrapping for named atomic vectors (see #43)
  • #44: Proper handling of NULL objects in diffStr
  • #41: Compilation Issues in Winbuilder


  • Initial Release

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.1.10 by Brodie Gaslam, 7 days ago


Report a bug at https://github.com/brodieG/diffobj/issues

Browse source code at https://github.com/cran/diffobj

Authors: Brodie Gaslam [aut, cre], Michael B. Allen [ctb, cph] (Original C implementation of Myers Diff Algorithm)

Documentation:   PDF Manual  

GPL (>= 2) license

Imports crayon, tools, methods, utils, stats

Suggests knitr, rmarkdown, testthat

Imported by unitizer.

See at CRAN