出于记录目的,我想要一些 html 输出中的情节代码,但不是情节。后来,我必须调用绘图代码,并向绘图添加一些内容,但只能看到附加代码。我试过这个:
```{r non.finished.plotting, eval=FALSE}
plot(1,type="n")
```
Some explanatory text here in the output:
"This produces an empty plot, and we could now add some points to it manually."
```{r add.layer, fig.width=5, fig.height=5}
<<non.finished.plotting, echo=FALSE>>
points(x=rnorm(100,1,0.1), y=rnorm(100,0.8,0.1) )
```
我在以下位置找到了回声符号Yihui's,但是当我编织这个时,我在输出中收到一条错误消息。
## Error: plot.new has not been called yet
我也尝试摆弄块选项,但我找不到满足我要求的组合。
(抱歉,这是非常基本的,但我没有找到与此示例类似的内容。)
块参考<<>>
不尊重块选项,所以<<non.finished.plotting, echo=FALSE>>
不管用。你能做的就是移动 chunk 选项echo
回到主块,如下所示:
```{r add.layer, fig.width=5, fig.height=5, echo=-1}
<<non.finished.plotting>>
points(x=rnorm(100,1,0.1), y=rnorm(100,0.8,0.1) )
```
echo=-1
表示不回显第一个表达式(如有记录的)。这可能就是您想要的:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)