Open caparks2 opened 10 months ago
This is an issue in knitr - I'm in talk with the devs
@cderv looping you in so you have an eye on it
Hi.
This is the document[^1] I used to test
---
title: "test"
output:
html_document:
keep_md: true
---
```{r}
library(ggplot2)
library(patchwork)
p1 <- pressure |>
ggplot(aes(temperature, pressure)) +
geom_point()
p1
p2 <- p1 +
geom_smooth(
method = 'lm',
formula = y ~ poly(x, 5),
se = FALSE
)
p2
patch <- p1 + p2
patch
* Rendering this document using `rmarkdown::render()` will not show a table output for the patch chunk
![image](https://github.com/thomasp85/patchwork/assets/6791940/4cfbb3cc-64d5-479d-88b0-563b05fa9a92)
* However, showing interactive chunk result inline will reproduce what you are seeing. This mean by adding the config to the document
````yaml
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
[^1]: please next time share a code we can copy paste or download instead of screenshot as this is easier for us. thanks
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 usinginvisible()
. In an R Markdown document usingknitr
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
Quarto