Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot turn off printing of TLBR table in R Markdown or Quarto documents when composing plots with wrap_plots or + #331

Closed
caparks2 opened this issue Sep 6, 2023 · 3 comments

Comments

@caparks2
Copy link

caparks2 commented Sep 6, 2023

When composing plots using wrap_plots() or plot arithmetic operators in an R Markdown or Quarto document, and assigning the resulting patchwork to an object using <-, a table with columns "t", "l", "b", and "r" is printed in line as an output of the chunk. This cannot be avoided using invisible(). In an R Markdown document using knitr chunk options {r, results='hide'} fails to prevent the table from being printed while {r, include=FALSE} succeeds. In a Quarto document the execution option #| output: false fails while #| include: false succeeds.

R Markdown

image

Quarto

image

@thomasp85
Copy link
Owner

This is an issue in knitr - I'm in talk with the devs

@thomasp85
Copy link
Owner

@cderv looping you in so you have an eye on it

@cderv
Copy link

cderv commented Oct 30, 2023

Hi.

This is the document1 I used to test

---
title: "test"
output: 
  html_document:
    keep_md: true
---

```{r}
library(ggplot2)
library(patchwork)
```

```{r}
p1 <- pressure |> 
  ggplot(aes(temperature, pressure)) + 
  geom_point()
```

```{r}
p1
```


```{r}
p2 <- p1 + 
  geom_smooth(
    method = 'lm',
    formula = y ~ poly(x, 5),
    se = FALSE
  )
```

```{r}
p2
```


```{r}
patch <- p1 + p2
```

```{r}
patch
```
  • Rendering this document using rmarkdown::render() will not show a table output for the patch chunk
    image

  • However, showing interactive chunk result inline will reproduce what you are seeing. This mean by adding the config to the document

     editor_options: 
       chunk_output_type: inline

So I would say this is an RSTUDIO IDE issue that seems to print the patch <- p1 + p2 somehow. RStudio IDE has its printing method for the chunk interactive rendering and they do not live in rmarkdown or knitr.

This is tracked already at

Hope it helps


Footnotes

  1. please next time share a code we can copy paste or download instead of screenshot as this is easier for us. thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants