以下R-减价代码不与Knitr工作:重用图形设备
Create a bimodal toy distribution.
```{r}
a = c(rnorm(100, 5, 2), rnorm(100, 15, 3))
```
Set up the graphics device.
```{r fig.show='hide'}
plot(0, type = 'n', xlim = c(0, 20), ylim = c(0, 0.2), axes = FALSE)
```
Plot the density.
```{r}
polygon(density(a), col = 'black')
```
Knitr假设一个图形设备在的R代码块的结尾处结束,并且关闭装置。因此,我不能重用(在第三个代码块中)以前设置的图形设备。
我的问题很简单:我该如何做这项工作?
我知道。我明确想知道如何防止这种情况。 – 2014-09-19 10:52:05