What does #| do in R script

I was commenting some code, and for styling purposes, added a "|" after the #, like this:

#| comment here

This caused the comment to turn gray. Not sure if I searched using the wrong terms but couldn't find anything about it in the RStudio portal or stackexchange. Appreciate if someone could explain what this does.

Create a new Quarto Document and look at the sample content. It explains that #| can be used within a code chunk to add options to executable code, like #| echo: false, rather than in the chunk's header, like {r, echo = FALSE}. RStudio must use that display format anytime you type #|, whether it is in a Quarto Document or R Notebook.

I think it acts like a regular comment in the later, so keep using it for comments if that style works for you.

Thanks @EconProf , appreciate the info!

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.