Showing images in using IFelse condition in R markdown

How to show images using ifelse condition in R Markdown word output. Please suggest any code/online reference for the same.

knitr code chunk options are simply R code, so you can have a code chunk that only runs based on some condition. For example,

---
output: rmarkdown::word_document
---

```{r}
show_image <- TRUE
```

```{r eval=show_image}
# Some plotting code
plot(...)
```

Whether show_image evlauates to TRUE or FALSE will control whether the code chunk is evaluated and the plot is included in the document.

@mattwarkentin, can you please share with me a full code sample showing how to place image within the ifelse statement?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.