Write markdown documents with an R-code that doesn't work, with a view to
I am experimenting with using Markdown to write homework for a course that includes some R coding. Since this is homework, I am deliberately writing code that causes errors; Can Markdown be used to render R code in a code-like manner without evaluating it (or catch errors somehow)?
source to share
If you are using R markdown the placement eval=FALSE
in the snippet parameters should work. Or use try()
. Or, if you are using knitr
, I believe the default chunk option error=FALSE
does not actually stop compilation when it encounters an error, but just moves on to the next chunk (which drives me crazy sometimes).
source to share