dat*_*ter 4 r r-markdown purrr
当我编织包含通过 purrr:map 函数获得的多个绘图的文档时,我在每个包含不需要的列表索引信息的绘图幻灯片之间获得文本幻灯片(请参阅图像幻灯片 2、4 和 6)。我想删除这些并且只有情节。
results = "hide"并results = FALSE在标题中。这些只返回一个图而不是多个图,并且文本仍然存在。我怎样才能删除这些并只有三张幻灯片,其中三张图没有文字?
---
title: "Reprex"
output: powerpoint_presentation
---
```{r include=FALSE}
library(tidyverse)
```
```{r echo=FALSE, results = FALSE}
ys <- c("mpg","cyl","disp")
ys %>% map(function(y)
invisible(ggplot(mtcars, aes(hp)) + geom_point(aes_string(y=y))))
```
Run Code Online (Sandbox Code Playgroud)
尝试这个:
purrr::walk使用map. 参见https://chrisbeeley.net/?p=1198results='asis'并在每个图后添加两个换行符cat('\n\n')。
---
title: "Reprex"
output: powerpoint_presentation
---
```{r include=FALSE}
library(tidyverse)
```
```{r echo=FALSE, results='asis'}
ys <- c("mpg","cyl","disp")
walk(ys, function(y) {
p <- ggplot(mtcars, aes(hp)) + geom_point(aes_string(y=y))
print(p)
cat('\n\n')
})
```
Run Code Online (Sandbox Code Playgroud)