kanpu kanpu - 2 months ago 18
R Question

How to "hide" the picture by the quantmod in rmarkdown

I use RStudio 0.99.903.

I want to draw a picture by the quantmod in rmarkdown. Here below is the code:

{r, echo=FALSE}
getSymbols("AAPL")
chartSeries(AAPL)
addADX()


I only want the final picture to be show in the document. But there will be two of them, one without ADX, one with ADX.

How to do that?

J_F J_F
Answer

I think this will be a possible solution:

---
title: "Untitled"
output: html_document
---

```{r, include=FALSE}
    library(quantmod)
    getSymbols("AAPL")   
    chartSeries(AAPL)
```
```{r, echo = FALSE}
    addADX()  
```

This means, that the first chunk is executed but you don't see the result (include = FALSE) and the result second one appears in your document, but not the function call (echo = FALSE).