Hi all,
Is there any option to prevent all {bash}
code chunks from being evaluated?
I know I can set it for each chunk with eval=FALSE
, but I was hoping there would be a way to do this for all chunks at once.
Thanks,
Ramiro
Hi all,
Is there any option to prevent all {bash}
code chunks from being evaluated?
I know I can set it for each chunk with eval=FALSE
, but I was hoping there would be a way to do this for all chunks at once.
Thanks,
Ramiro
You can specify an option hook that sets eval
to FALSE
if engine
is bash
. In the example Rmd file below, only the code in the R chunk will be evaluated:
---
title: "Untitled"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_hooks$set(eval = function(options) {
if (options$engine == "bash") {
options$eval <- FALSE
}
options
})
```
```{r}
print("run")
```
```{bash}
echo "run"
```
You can read more about option hooks in the chapter Option hooks from the R Markdown Cookbook.
Great, Thanks a lot for your help
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.