小编use*_*409的帖子

在knitr rmarkdown中绘制动画

问题:

嗨,我尝试在rmarkdown文档中制作动画情节.这是我的代码:

```{r lmSim, fig.show='animate'}
library(animation)
library(plyr)

oopt = ani.options(interval = 0.3, nmax = 101)

a <- sort(rnorm(100, 2))
b <- sort(rnorm(100, 7))
out <- vector("list", 101)
for (i in 1:ani.options("nmax")) {
  ji <- seq(from = 0, to = 5, by = .05)
  a <- jitter(a, factor = 1, amount = ji[i])
  fab1 <- lm(a ~ b)
  coe <- summary(fab1)$coefficients
  r2 <- summary(fab1)$r.squared
  if (coe[2, 4] < .0001) p <- " < .0001"
  if (coe[2, 4] < .001 & coe[2, …
Run Code Online (Sandbox Code Playgroud)

r knitr r-markdown

10
推荐指数
1
解决办法
4941
查看次数

标签 统计

knitr ×1

r ×1

r-markdown ×1