Is there an equivalent of "eval=F" for .R files?

Is there any equivalent to doing rmarkdown's "eval = F" for .R scripts? Basically, I want to source an .R file into a document I'm writing but I don't want all of the code to run.

Some solutions that come to mind are:

  • I could obviously consider splitting the .R script into two.
  • Moving the .R file into two chunks of a .rmd file
  • Comment out the code I don't want to run

However none of these solutions are what I'm looking for. Any ideas would be appreciated.

if you use knitr::spin to run your r script you can include rmarkdown code chunk options like eval=F
https://rmarkdown.rstudio.com/articles_report_from_r_script.html

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.