comment inline r code to avoid running the code

Hi,
When I comment inline r code with Cmd+Shift+C and render the markdown I get an error regarding that it still wants to run the inline r code.

<!-- `r myoutput` -->

if myoutput does not exist when knitting the error says that output is not found.

But I just commented that line so that I do not want the myoutput calculation. So it is does not work for my aim.

I have realized that following works:.

<!-- `# r myoutput` -->

I want to ask if it is possible to comment inline r code, so that it does not try to run it or is there a shortcut to add # to inline r code?

why do not you use # directly in front of < sign?

I think it will fully be a comment. I hope that is what you wanted.

Hi,
Thank you for the reply. But it is not a solution. I think attached gif explains my question better:
commenting-inline-r-code

Hi Serdarbalci!

You may need ```{r setup, echo=FALSE}

echo = FALSE prevents code, but not the results from appearing in the finished file.

Hi @demar01,

As you have suggested this knits without error. Thank you.

This one gives error:

And this gives error too:

Your suggestion is a partial solution.
I wished when I comment a line it will not treat the inline r code as a code, and ignore it.
Thank you again.

This is not yet supported. You'll need to give a vote in the issues

This topic was automatically closed 7 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.