Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

How to show code but hide output in RMarkdown?

$
0
0

I want my html file to show the code, but not the output of this chunk:

```{r echo=True, include=FALSE}
fun <- function(b)
    {
    for(a in b)
        {print(a)
        return(a * a)}
    }
y <- fun(b)
```

When I run the code, i need the print to see the progress (it is quite a long function in reality).

But in the knitr file, I use the output in a further chunk, so I do not want to see it in this one (and there's no notion of progress, since the code has already been run).

This echo=True, include=FALSE here does not work: the whole thing is hidden (which is the normal behavior of include=FALSE).

What are the parameters I could use to hide the prints, but show my code?


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>