Rmarkdown may have broken code, knit html output showing errors and warnings

Lets say that I have code in R that is not working , i.e. I run this code and get some errors and warnings, and I want to share the code and conclusions indicating errors and warnings, with a third party through R markdown ,

Can I knit an R markdown if I have errors in the r-blocks of the code? If so, will it show me waht errors and warnings on html output? The goal is to share the html output , showing errors, and all with broken code.

Any help on this is greatly appreciated. Thanks.

+6
source share
1 answer

Yes, use knitr::opts_chunk$set(error = TRUE)

Here is the full markdown:

 --- title: "Untitled" date: "September 21, 2016" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE, error = TRUE) ``` ## R Markdown Here is my error ```{r} 1 + 1 1 + "a" ``` 

Output:

Error

+10
source

All Articles