opts_current: how does it work in knitr?

五迷三道 提交于 2019-12-07 18:29:27

问题


I am trying to set up different figure size in different chunks. I first define a global settings using:

opts_chunk$set(fig.width=7, fig.height=7)

Then, for the specific chunks, I use:

opts_current$set(fig.width=7, fig.height=14)

But the later is always neglected. So, how does opts_current really work?


回答1:


For specific code chunks, put the chunk options in the chunk header, e.g.

```{r fig.width=7, fig.height=14}

These are called local chunk options, which will override global chunk options (temporarily for this specific chunk).



来源:https://stackoverflow.com/questions/25776547/opts-current-how-does-it-work-in-knitr

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