{"id":14068526,"url":"https://github.com/r-lib/waldo","last_synced_at":"2025-04-13T22:18:38.722Z","repository":{"id":40558704,"uuid":"251072539","full_name":"r-lib/waldo","owner":"r-lib","description":"Find differences between R objects","archived":false,"fork":false,"pushed_at":"2024-11-07T21:03:05.000Z","size":2685,"stargazers_count":291,"open_issues_count":6,"forks_count":20,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-13T22:18:27.476Z","etag":null,"topics":["diff","r","testing"],"latest_commit_sha":null,"homepage":"http://waldo.r-lib.org/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r-lib.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-29T16:00:40.000Z","updated_at":"2025-03-27T19:16:30.000Z","dependencies_parsed_at":"2022-08-09T23:01:05.342Z","dependency_job_id":"d99a4ba2-5f93-4d48-b693-25037eeec63c","html_url":"https://github.com/r-lib/waldo","commit_stats":{"total_commits":280,"total_committers":12,"mean_commits":"23.333333333333332","dds":0.05714285714285716,"last_synced_commit":"56819ce69801b4ff93f4c62e5572bf7bfdd4db4a"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fwaldo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fwaldo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fwaldo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fwaldo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r-lib","download_url":"https://codeload.github.com/r-lib/waldo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248788905,"owners_count":21161746,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["diff","r","testing"],"created_at":"2024-08-13T07:06:14.476Z","updated_at":"2025-04-13T22:18:38.696Z","avatar_url":"https://github.com/r-lib.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\nalways_allow_html: yes\neditor_options: \n  chunk_output_type: console\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README\",\n  out.width = \"100%\"\n)\n#\noptions(crayon.enabled = TRUE, crayon.colors = 256)\ncrayon::num_colors(forget = TRUE)\nasciicast::init_knitr_engine(\n  startup = quote({\n    library(waldo)\n    conflicted::conflict_prefer(\"compare\", \"waldo\")\n  }),\n  echo = TRUE,\n  echo_input = FALSE\n)\nset.seed(1014)\n```\n\n# waldo\n\n\u003c!-- badges: start --\u003e\n[![Codecov test coverage](https://codecov.io/gh/r-lib/waldo/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-lib/waldo?branch=main)\n[![R-CMD-check](https://github.com/r-lib/waldo/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/waldo/actions/workflows/R-CMD-check.yaml)\n\u003c!-- badges: end --\u003e\n\nThe 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. \n\n`waldo::compare()` is inspired by `all.equal()`, but takes additional care to generate actionable insights by:\n\n* Ordering the differences from most important to least important.\n* Displaying the values of atomic vectors that are actually different.\n* Carefully using colour to emphasise changes (while still being readable\n  when colour isn't available).\n* Using R code (not a text description) to show where differences arise.\n* Where possible, comparing elements by name, rather than by position.\n* Erring on the side of producing too much output, rather than too little.\n\n## Installation\n\nYou can install the released version of waldo from [CRAN](https://CRAN.R-project.org) with:\n\n``` r\ninstall.packages(\"waldo\")\n```\n\n## Comparisons\n\n```{r setup}\nlibrary(waldo)\n```\n\nWhen comparing atomic vectors, `compare()` produces diffs (thanks to [diffobj](https://github.com/brodieG/diffobj)) that highlight additions, deletions, and changes, along with a little context:\n\n*   Deletion\n    ```{asciicast}\n    compare(c(\"a\", \"b\", \"c\"), c(\"a\", \"b\"))\n    ```\n\n*   Addition\n    ```{asciicast}\n    compare(c(\"a\", \"b\"), c(\"a\", \"b\", \"c\"))\n    ```\n\n*   Change\n    ```{asciicast}\n    compare(c(\"a\", \"b\", \"c\"), c(\"a\", \"B\", \"c\"))\n    ```\n\n*   Long vectors with short differences only show local context around\n    changes, not everything that's the same.\n\n    ```{asciicast}\n    compare(c(\"X\", letters), c(letters, \"X\"))\n    ```\n\nDepending on the relative size of the differences and the width of your console you'll get one of three displays:\n\n*   The default display is to show the vectors one atop the other:\n\n    ```{asciicast}\n    compare(letters[1:5], letters[1:6])\n    ```\n\n*   If there's not enough room for that, the two vectors are shown \n    side-by-side:\n\n    ```{asciicast}\n    options(width = 20)\n    compare(letters[1:5], letters[1:6])\n    ```\n\n*   And if there's still not enough room for side-by-side, the each element\n    is given its own line:\n\n    ```{asciicast}\n    options(width = 10)\n    compare(letters[1:5], letters[1:6])\n    ```\n\nWhen comparing more complex objects, waldo creates an executable code path telling you where the differences lie:\n\n```{asciicast, include = FALSE}\noptions(width = 80)\n```\n\n*   Unnamed lists are compared by position: \n\n    ```{asciicast}\n    compare(list(factor(\"x\")), list(1L))\n    ```\n\n*   Named lists, including data frames, are compared by name. For example,\n    note that the following comparison reports a difference in the class and\n    names, but not the values of the columns.\n\n    ```{asciicast}\n    df1 \u003c- data.frame(x = 1:3, y = 3:1)\n    df2 \u003c- tibble::tibble(rev(df1))\n    compare(df1, df2)\n    ```\n\n*   Recursion can be arbitrarily deep:\n\n    ```{asciicast}\n    x \u003c- list(a = list(b = list(c = list(structure(1, e = 1)))))\n    y \u003c- list(a = list(b = list(c = list(structure(1, e = \"a\")))))\n    compare(x, y)\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fwaldo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-lib%2Fwaldo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fwaldo/lists"}