Sowmya S. Manian Sowmya S. Manian - 1 year ago 82
R Question

Can Rmarkdown having a non working code, knit html output showing the errors and warnings

Lets say I have code in R which is

not working
, i.e. I run that code and get some errors and warnings, and I want to share the code and output showing errors and warnings, with the third person through
R markdown

Is it possible to knit R markdown if I have errors in r code chunks?, If yes, then is it going to show me waht errors and warnings occurs in the html output? Goal is to share the
html output
showing errors and everything with the non working code.

Any help on this is highly appreciated. Thanks.

Answer Source

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

1 + 1
1 + "a"



Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download