insightsengineering / insightsengineering/osprey

[Bug]: Mismatch between documentation and output

Open
#150 0 comments 0 reactions 0 assignees View on GitHub
bug core
Dominant language
R
Stars
5
Forks
1
PR merge metrics
No merged PRs in 30d

Description

### What happened?

When checking code reproducibility of some modules via the teal.gallery on ealy-dev I noticed some functions directly renders a plot even if the resulting object is not printed:

- `g_events_term_id`
- `g_butterfly`
- `g_ae_sub`
- `g_spiderplot`
- `g_waterfall`

In addition, some of the documented values returned are "plot object", or in the case of `g_butterfly`: "ggplot object". While they do not return a ggplot2 (`gg`, `ggplot`) object but a gtables from the gtables package.
This object requires using `plot(plot)` in order to generate the plot as the `print` method doesn't dispatch to `plot`.
(in this case the example on `g_waterfall` and then the example on `g_ae_sub`)

```r
> p1 <- g_ae_sub(...) # Example of g_ae_sub: New plot is rendered
> p1 # Plot is not rendered, instead this is printed:
TableGrob (4 x 4) "arrange": 9 grobs
z cells name grob
1 1 (2-2,1-1) arrange absoluteGrob[GRID.absoluteGrob.302]
2 2 (1-1,2-2) arrange absoluteGrob[GRID.absoluteGrob.323]
3 3 (2-2,2-2) arrange gTree[panel-1.gTree.320]
4 4 (2-2,3-3) arrange gTree[panel-1.gTree.293]
5 5 (3-3,3-3) arrange absoluteGrob[GRID.absoluteGrob.299]
6 6 (1-1,4-4) arrange absoluteGrob[GRID.absoluteGrob.347]
7 7 (2-2,4-4) arrange gTree[panel-1.gTree.344]
8 8 (1-1,3-3) arrange text[GRID.text.360]
9 9 (4-4,3-3) arrange gtable[arrange]
> plot(p1) # plot is rendered
```

### sessionInfo()

```R

```

### Relevant log output

```R

```

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct.

### Contribution Guidelines

- [x] I agree to follow this project's Contribution Guidelines.

### Security Policy

- [x] I agree to follow this project's Security Policy.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.