In the Rmarkdown document, we can apply certain parameters to each fragment of the R code, which determines whether the code will be executed, printed inside, output error messages, etc.
To not execute a specific piece of code, use:
```{r cars, eval=FALSE} summary(cars) ```
To prevent a specific piece of code from starting or printing in the created document, use:
```{r cars, eval=FALSE, echo=FALSE} summary(cars) ```
"TRUE" is used for opposite effects and is the default value.
If you have a lot of code snippets that you need to comment on, you can accept the offer from @ eipi10 (thanks) and use find / replace with the regex option selected. Thus, the find will be "(` `` {r. *) ", And the replacement will be" \ 1, eval = FALSE, echo = FALSE} "(without double quotes).
source share