Mark Mark - 6 months ago 38
Markdown Question

Hiding the R code in Rmarkdown/knit and just showing the results

In my R markdown code I sometimes want to just generate a report without showing the actual code (specially when I send it to my boss). How can I hide the R code and just show the graph and results

for example

```{r fig.width=7, fig.height=6}
a<-as.numeric(some data)
hist(a, breaks=24)


Shows both the commands and a histogram. How can I remove the commands from my HTML report?


Sure, just do

```{r someVar, echo=FALSE}

to show some (previously computed) variable someVariable. Or run code that prints etc pp.

So for plotting, I have eg

### Impact of choice of ....
```{r somePlot, echo=FALSE}
plotResults(Res, Grid, "some text", "some more text")

where the plotting function plotResults is from a local package.