I’m experimenting with using Markdown to write homework problems for a course that involves some R coding. Because these are homework sets, I intentionally write code that throws errors;. Is it possible to use Markdown to display R code in the code style without evaluating it (or to trap the errors somehow)?
I’m experimenting with using Markdown to write homework problems for a course that involves
Share
If you’re using R markdown, putting
eval=FALSEin the chunk options should work. Or usetry(). Or, if you’re usingknitras well, I believe that the default chunk optionerror=FALSEdoesn’t actually stop the compilation when it encounters an error, but just proceeds to the next chunk (which sometimes drives me crazy).