In a vignette demonstrating how to use a Suggested
package, I have something like this:
if (suggested_package_not_available) {
knitr::opts_chunk$set(eval = FALSE)
}
This means that the vignette still runs etc. although the Suggested
package is not available. It just shows the code, not the results.
Can I do something similar for inline R
code (`r code`
)?
Maybe a hook that uses a regex (a la `r [^`]+`
) to add two backticks around the inline code so that the inline code is showed instead of evaluated (which would normally cause an error because the chunks are no longer evaluated)?