Reputation: 63
I would like to limit the number of lines that are produced from a function when I knit my markdown document in R. I've looked around quite a lot but can't find a solution.
My code is below, it gives 50+ lines of data when run. My goal is to only have 9 lines of code produced by the sedist function.
```{r, results=1:9}
sedist(FILENAME, method="correlation")
```
I have tried using {r, message=1:9}
, {r, Hide=1:9}
, {r, height=1:9}
, {r, results='hide'}
and similar.
Upvotes: 6
Views: 3639
Reputation: 59375
Something like this??
```{r R.options=list(max.print=10)}
df <- data.frame(x=1:100,y=1:100)
df
```
The R.options
chunk option in knitr
allows you to set any of R's options locally for that chunk. Look at ?options
for a list of the options you can set
Upvotes: 8