Limit Output of Function in Rstudio (3.1.1) when Knitting to PDF

☆樱花仙子☆ 提交于 2019-12-22 05:11:29

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/26207192/limit-output-of-function-in-rstudio-3-1-1-when-knitting-to-pdf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!