I have been exploring with R Markdown and came across this question. All the reproducible example reports I found online such as this http://jeromyanglim.blogspot.ca/2012/05/example-reproducile-report-using-r.html has the code followed by the result.
I want to have just the result therefore hiding the code from the audience. For example, I would just like to display the end result of ggplot2 or googlevis without showing the long lines of loading data and coding.
Is there a way to do so?
If you prefer to use the console by default for all your R Markdown documents (restoring the behavior in previous versions of RStudio), you can make Chunk Output in Console the default: Tools -> Options -> R Markdown -> Show output inline for all R Markdown documents .
include = FALSE prevents code and results from appearing in the finished file. R Markdown still runs the code in the chunk, and the results can be used by other chunks. echo = FALSE prevents code, but not the results from appearing in the finished file.
You use results="hide" to hide the results/output (but here the code would still be displayed). You use include=FALSE to have the chunk evaluated, but neither the code nor its output displayed.
The solution to this problem is the chunk option results = 'asis' . This option tells knitr not to wrap your text output in verbatim code blocks, but treat it “as is.” This can be particularly useful when you want to generate content dynamically from R code.
Just add echo = FALSE
to the code chunk options.
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