Comments can be used to explain R code, and to make it more readable. It can also be used to prevent execution when testing alternative code. Comments starts with a # . When executing code, R will ignore anything that starts with # .
The easiest way to create a multi-line comment in RStudio is to highlight the text and press Ctrl + Shift + C. You can just as easily remove the comment by highlighting the text again and pressing Ctrl + Shift + C.
I think you should be able to use regular html comments:
<!-- regular html comment -->
Does this work for you?
Extra yaml blocks can be used anywhere inside the document, and commented out with #
---
title: "Untitled"
output: html_document
---
No comment.
---
# here's a comment
# ```{r}
# x = pi
# ```
---
Note however that this does not prevent knitr from evaluating inline r code.
After drag the lines you want to make comment, press SHIFT+CMD+C (macOS), SHIFT+CTRL+C (Windows). This is the shortcut of R Markdown editor (R Studio) to comment out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With