I used to generate reports using Rstudio and knitr with the following options set in the beginning of my markdown file:
```{r global_options, include = FALSE}
knitr::opts_chunk$set(echo = FALSE,
warning = FALSE,
messages = FALSE,
include=FALSE)
```
The plots generated in different chunks would be rendered as expected.
However, as of a few days ago, my reports don't seem to render plots in the html report if I include the include=FALSE
option as a chunk setting. They do appear if I remove this statement (but then a bunch of other unsightly messages preceded by ##
get printed as well).
The intended audience for the report is not interested in the ##
messages or the code, mainly the plots and some plain text explanation and tables.
Update:
The reason I used include = FALSE
is because of the information I found here: https://yihui.name/knitr/options/
...include: (TRUE; logical) whether to include the chunk output in the final output document; if include=FALSE, nothing will be written into the output document, but the code is still evaluated and plot files are generated if there are any plots in the chunk, so you can manually insert figures...
I am confused because now when I use include = FALSE
my plots go missing.
R sessionInfo()
## R version 3.3.1 (2016-06-21)
## Platform: x86_64-apple-darwin13.4.0 (64-bit)
## Running under: OS X 10.11.6 (El Capitan)
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## loaded via a namespace (and not attached):
## [1] backports_1.0.5 magrittr_1.5 rprojroot_1.2 formatR_1.4
## [5] tools_3.3.1 htmltools_0.3.5 yaml_2.1.13 Rcpp_0.12.7
## [9] stringi_1.1.2 rmarkdown_1.3 knitr_1.14 stringr_1.1.0
## [13] digest_0.6.10 evaluate_0.10
To see the plot but no code, you can use:
```{r global_options, include=FALSE}
knitr::opts_chunk$set(echo = FALSE,
warning = FALSE,
messages = FALSE,
include = TRUE,
results = "hide")
```
For me it is not surprising that you see no plot, because include = TRUE
will suppress code and plot. In the new setting you suppress the code but show the plots.
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