opts_current:如何在knitr中工作? [英] opts_current: how does it work in knitr?

查看:93
本文介绍了opts_current:如何在knitr中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在不同的块中设置不同的图形尺寸.我首先使用以下命令定义全局设置:

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)

但是后者总是被忽略.那么,opts_current到底如何工作?

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

推荐答案

对于特定的代码块,请将块选项放在块头中,例如

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).

这篇关于opts_current:如何在knitr中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆