0

Is there a way to not display 'text' (not code) in an R markdown when it is output to HTML? For example:

```{r, echo=False}
I want the output of this R Code
```

This is text to introduce the next section in the .Rmd file. I, however, do NOT want this to appear in my .HTML file.

```{r, echo=False}
Next section of R code to display
```
r2evans
  • 141,215
  • 6
  • 77
  • 149
xfrostyy
  • 37
  • 5
  • Code in the `\`\`\`{...}` needs to be R code, so `echo=FALSE`. – r2evans Jul 12 '21 at 14:31
  • [This](https://stackoverflow.com/questions/4823468/comments-in-markdown) previous question may be helpful. – Limey Jul 12 '21 at 14:36
  • I think something like `include=FALSE, echo=FALSE` will allow it to execute but have none of its output rendered into the document. If that isn't what you mean, please clarify. Thanks! – r2evans Jul 12 '21 at 18:20

1 Answers1

0

whatever you don't want to show in output, put it between <!--- blabla -->

For example:

```{r, echo=FALSE}
I want the output of this R Code```

<!---
This is text to introduce the next section in the .Rmd file. I, however, do NOT want this to appear in my .HTML file.
-->

```{r, echo=FALSE}
Next section of R code to display```
GZS
  • 47
  • 6
  • That's not what I was saying. The OP is using mixed-case `=False`, and I think (without verifying at the moment) that the assignments in there need to be proper R expressions, so change to upper-case `=FALSE`. – r2evans Jul 12 '21 at 18:12
  • 1
    Oh, I misunderstood your point. You are absolutely right :) – GZS Jul 12 '21 at 18:17