When I knit a document containing multiple plots obtained through purrr:map function, I get text slides in between each plot slide containing unwanted list index information (see image slides 2, 4, and 6). I'd like to remove these and just have plots.
results = "hide" and results = FALSE in the header.
These just return one plot instead of many, AND the text is still
there.How can I remove these and just have three slides with the three plots with no text?

---
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))))
```
Try this:
purrr::walk instead of map. See e.g. https://chrisbeeley.net/?p=1198results='asis' and add two newlines via cat('\n\n') after each plot.
    ---
    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')
    })
    ```

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With