An open API service indexing awesome lists of open source software.

https://github.com/moodymudskipper/woof

wadlo's companion package
https://github.com/moodymudskipper/woof

Last synced: 2 days ago
JSON representation

wadlo's companion package

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# woof

{woof} is {waldo}'s [companion](https://waldo.fandom.com/wiki/Woof).

* Given a "waldo_compare" object `woof::woof()` returns
a nested list easier to explore and programatically work with. Any subset
of the output prints like `waldo:compare()`'s output does.

* `woof::woof_compare()` is a drop-in replacement for `waldo::compare()`, it prints
just the same but can be subsetted.

## Installation

Install with:

``` r
devtools::install_github("moodymudskipper/woof")
```

## Example

```{r example}
library(woof)

# we build 2 different lists
foo <- list(
a = "b",
list(c = list("d"), x = "e"),
f = "g"
)
attr(foo$a, "my_attr") <- "attr1"

bar <- list(
a = "B",
list(c = list("D"), x = "E")
)
attr(bar$a, "my_attr") <- "attr2"

w <- woof_compare(foo, bar)

w # prints like waldo::compare's output

w$`2`

w$`1`$..attr

library(ggplot2)
p1 <- ggplot(cars, aes(speed, dist)) + geom_point()
p2 <- ggplot(cars, aes(speed, dist)) + geom_line()
w <- woof_compare(p1, p2)

# the original output is huge, but we can navigate it easily with autocomplete
w$layers$`1`$geom_params
```