结合ř降价和动画包 [英] Combining R Markdown and Animation Package

查看:144
本文介绍了结合ř降价和动画包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法结合动画包和R降价?我要生成动画,我想包括在从研发降价生成的HTML文件描述。

Is there a way to combine animation package and r markdown? I want to generate animation which i want to include and describe in html file generated from r markdown.

当然,我可以从 saveHTML 嵌入code或 saveGIF 文件中已经阵列生成的R降价文件,但我想这个过程自动化。

Of course I can embed code from saveHTML or saveGIF file in already generated r markdown file, but i want to automate this process.

我工作在Windows上,R 15.1,最后RStudio。

I'm working on Windows, R 15.1 and the last RStudio.

推荐答案

下面是从knitr图形手动时钟的例子(见对你的问题的评论)在降价:

Here is the clock example from the knitr graphics manual (see comment on your question) in markdown:

```{r clock, fig.width=7, fig.height=6, fig.show='animate'}
par(mar = rep(3, 4))
for (i in seq(pi/2, -4/3 * pi, length = 12)) {
    plot(0, 0, pch = 20, ann = FALSE, axes = FALSE)
    arrows(0, 0, cos(i), sin(i))
    axis(1, 0, "VI"); axis(2, 0, "IX")
    axis(3, 0, "XII"); axis(4, 0, "III"); box()
}
```

您需要有的ffmpeg 可执行文件路径为它工作。 Knitr将使用动画包装,这反过来将调用的ffmpeg产生被嵌入在HTML输出的MP4文件。

You need to have the ffmpeg executable in your path for it to work. Knitr will use the animation package, which in turn will call ffmpeg to generate an mp4 file which is embedded in your html output.

这篇关于结合ř降价和动画包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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