All Projects → r-lib → Waldo

r-lib / Waldo

Licence: other
Find differences between R objects

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to Waldo

Winmerge
WinMerge is an Open Source differencing and merging tool for Windows. WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.
Stars: ✭ 2,358 (+1329.09%)
Mutual labels:  diff
Sitediff
SiteDiff makes it easy to see differences between two versions of a website.
Stars: ✭ 139 (-15.76%)
Mutual labels:  diff
Coveragechecker
Allows old code to use new standards
Stars: ✭ 159 (-3.64%)
Mutual labels:  diff
Golive
⚡ Live views for GoLang with reactive HTML over WebSockets 🔌
Stars: ✭ 130 (-21.21%)
Mutual labels:  diff
Docker Diff
🐳 Compare Docker images
Stars: ✭ 137 (-16.97%)
Mutual labels:  diff
Php Htmldiff
A library for comparing two HTML files/snippets and highlighting the differences using simple HTML. Includes support for comparing complex lists and tables
Stars: ✭ 145 (-12.12%)
Mutual labels:  diff
Learnvue
Vue.js 源码解析
Stars: ✭ 11,516 (+6879.39%)
Mutual labels:  diff
Api Diff
A command line tool for diffing json rest APIs
Stars: ✭ 164 (-0.61%)
Mutual labels:  diff
Cfgdiff
diff(1) all your configs
Stars: ✭ 138 (-16.36%)
Mutual labels:  diff
Deepdiff
🦀Amazingly incredible extraordinary lightning fast diffing in Swift
Stars: ✭ 1,995 (+1109.09%)
Mutual labels:  diff
Diffchar.vim
Highlight the exact differences, based on characters and words
Stars: ✭ 132 (-20%)
Mutual labels:  diff
Angular Diff Match Patch
An AngularJS wrapper for google-diff-match-patch
Stars: ✭ 135 (-18.18%)
Mutual labels:  diff
Dwifft
Swift Diff
Stars: ✭ 1,822 (+1004.24%)
Mutual labels:  diff
Diff2html
Pretty diff to html javascript library (diff2html)
Stars: ✭ 1,867 (+1031.52%)
Mutual labels:  diff
Graphtage
A semantic diff utility and library for tree-like files such as JSON, JSON5, XML, HTML, YAML, and CSV.
Stars: ✭ 2,062 (+1149.7%)
Mutual labels:  diff
Php Diff
A comprehensive library for generating differences between two strings in multiple formats (unified, side by side HTML etc).
Stars: ✭ 126 (-23.64%)
Mutual labels:  diff
Tqsdk Python
天勤量化开发包, 期货量化, 实时行情/历史数据/实盘交易
Stars: ✭ 2,213 (+1241.21%)
Mutual labels:  diff
Textdistance
Compute distance between sequences. 30+ algorithms, pure python implementation, common interface, optional external libs usage.
Stars: ✭ 2,575 (+1460.61%)
Mutual labels:  diff
Swagger Diff
🎿 Compare two swagger API specifications(1.x or v2.0)
Stars: ✭ 161 (-2.42%)
Mutual labels:  diff
Composer Lock Diff
See what has changed after a composer update
Stars: ✭ 154 (-6.67%)
Mutual labels:  diff

waldo

Codecov test coverage R build status

The goal of waldo is to find and concisely describe the difference between a pair of R objects, with the primary goal of making it easier to figure out what’s gone wrong in your unit tests.

waldo::compare() is inspired by all.equal(), but takes additional care to generate actionable insights by:

  • Ordering the differences from most important to least important.
  • Displaying the values of atomic vectors that are actually different.
  • Carefully using colour to emphasise changes (while still being readable when colour isn’t available).
  • Using R code (not a text description) to show where differences arise.
  • Where possible, comparing elements by name, rather than by position.
  • Erring on the side of producing too much output, rather than too little.

Installation

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

install.packages("waldo")

Comparisons

library(waldo)

When comparing atomic vectors, compare() produces diffs (thanks to diffobj) that highlight additions, deletions, and changes, along with a little context:

  • Addition

    compare(c("a", "b", "c"), c("a", "b"))
    
  • Deletion

    compare(c("a", "b"), c("a", "b", "c"))
    
  • Change

    compare(c("a", "b", "c"), c("a", "B", "c"))
    
  • Long vectors with short differences only show local context around changes, not everything that’s the same.

    compare(c("X", letters), c(letters, "X"))
    

Depending on the relative size of the differences and the width of your console you’ll get one of three displays:

  • The default display is to show the vectors one atop the other:

    compare(c("x", "y", "a", "b", "c"), c("y", "a", "B", "c", "d"))
    
  • If there’s not enough room for that, the two vectors are shown side-by-side:

    options(width = 20)
    compare(c("x", "y", "a", "b", "c"), c("y", "a", "B", "c", "d"))
    
  • And if there’s still not enough room for side-by-side, the each element is given its own line:

    options(width = 10)
    compare(c("x", "y", "a", "b", "c"), c("y", "a", "B", "c", "d"))
    

When comparing more complex objects, waldo creates an executable code path telling you where the differences lie:

  • Unnamed lists are compared by position:

    compare(list(factor("x")), list(1L))
    
  • Named lists, including data frames, are compared by name. For example, note that the following comparison reports a difference in the class and names, but not the values of the columns.

    df1 <- data.frame(x = 1:3, y = 3:1)
    df2 <- tibble::tibble(rev(df1))
    compare(df1, df2)
    
  • Recursion can be arbitrarily deep:

    x <- list(a = list(b = list(c = list(structure(1, e = 1)))))
    y <- list(a = list(b = list(c = list(structure(1, e = "a")))))
    compare(x, y)
    
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].