使用 R 写博客:将 R 嵌入博客文章的简单方法?
有一个非常好的 R 的 Mediawiki 插件,它允许您可以将 R 代码嵌入到任何 wiki 页面中。配置需要花费一些精力,但是一旦配置到位,它就非常有用。
有谁知道在博客文章中嵌入 R 的等效方法吗?我唯一能找到的是 这个名为 RWebFriend 的 WordPress 插件,但它只允许您将代码发送到Rweb。我正在设想一些东西,您可以将代码嵌入两个标签之间,然后执行并返回它。
There is a very nice Mediawiki plugin for R which allows you to embed R code in any wiki page. It takes a little effort to configure, but it's really useful once you have it in place.
Does anyone know of an equivalent for embedding R in a blog post? The only thing I could find was this wordpress plugin called RWebFriend, but it only allows you to send code to Rweb. I'm envisioning something where you can embed your code between two tags and it is executed and returned.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
我看到有一个帖子今天“学习 R”博客上的这个主题就是这样的。真是巧合啊!
这使用 Sweave 以及名为 blogpost.py(来自 Stuart Rackham)的 Python 脚本来创建实际输出< /a> 将结果上传到 WordPress 博客。我喜欢这种方法,因为使用 Sweave 意味着您的博客输出可以轻松转换为论文或演示文稿 (使用 Beamer),因此从长远来看,博客变得更加有用。
I see that there is a posting on this very subject on the "Learning R" blog today. What a coincidence!
This uses Sweave to create the actual output, along with a Python script called blogpost.py (from Stuart Rackham) to upload the results onto the Wordpress blog. I like that approach because using Sweave means that your blog output could easily be converted into a paper or a presentation (with Beamer), so blogging becomes even more useful in the long run.
您可能必须将 R 集成到您的博客引擎中,就像 MediaWiki 扩展一样。
或者,换个方式,您使用 Rpad 并围绕其基于 Web 的 R 界面包装博客引擎。
You may have to integrate R into your blogging engine, not unlike the MediaWiki extension.
Or, going the other way, you take Rpad and wrap a blog engine around its web-based R interface.
我看到你一年前问过这个问题,由于此后有一些更新(与 WordPress 博客相关),我想参考它们。
我就该主题写了两篇文章:
ps:我也在 关于 R 的博客,但链接到的其他帖子是回答您的问题的帖子。
干杯,塔尔
I see you asked this a year ago, and since there has been some updates since (relevant to WordPress blogs), I thought of referencing them.
I wrote two posts on the topic:
p.s: I also published the talk I gave on useR2010 with other tips on blogging about R, but the other the posts linked to are the ones answering your question.
Cheers, Tal
截至 2014 年 11 月,有一种简单的方法可以从 R 发布博客到托管在 github 页面上的博客。没有数据库,没有本地环境,没有新的管理面板。只需要 Web 浏览器、github 和 R。
_config.yml
设置一些全局变量(在这里你可以设置RSS、Disqus、Google Analytics等)。_posts
目录中。rmarkdown
或knitr
将Rmd
文件渲染为md
。YYYY-MM-DD-my-first_post.md
上传/复制并粘贴到_posts
目录。例如我的极简主义博客:jangorecki.github.io
它的存储库位于 github.com/jangorecki/jangorecki.github.io
还存储
存储库中的 Rmd
文件使任何人都能够在 R 中本地重现帖子(当然还有 R 块)。As of November 2014 there is easy method to blog from R to your blog hosted on github pages. No databases, no local environment, no new admin panels. Only web browser, github and R are required.
_config.yml
to set some global variables (here you can setup RSS, Disqus, Google Analytics, etc.)._posts
directory.rmarkdown
orknitr
to render yourRmd
file tomd
.YYYY-MM-DD-my-first_post.md
to_posts
directory.As example my minimalist blog at: jangorecki.github.io
It's repo at github.com/jangorecki/jangorecki.github.io
Also storing
Rmd
files in your repo gives ability to reproduce the post (+R chunks of course) locally in R by anybody.有一篇关于 Blogistic Reflections 博客的帖子正在使用 Emacs/ESS org-mode 来获取 HTML 导出功能。
There's a post on Blogistic Reflections blog how he is using Emacs/ESS org-mode to get the HTML export functionality.
大多数博客软件都有 XML-RPC 接口。因此,从 R 写博客的最简单方法是使用这个包: http://www.omegahat.org /XMLRPC/ 和 RCurl 也可以在该站点上找到。
这将是迄今为止最简单的方法。如果您搜索 XML-RPC 和 Wordpress,您可以找到为 php 编写的代码,但它也可以帮助编写 R 代码。
Most blogging software has an XML-RPC interface. So the easiest way to blog from R, could be by using this package: http://www.omegahat.org/XMLRPC/ and RCurl which can also be found on that site.
This would be by far the easiest way to go. If you google XML-RPC and Wordpress you can find code written for php, but it could help for writing the R code as well.
为了将 Markdown 转移到 blogspot,可以结合使用命令行工具 Pandoc、R-package ascii 和 Python gdata 模块。请参阅我的博文
For sweaving markdown to blogspot, a combination of the commandline tool Pandoc, R-package ascii and Python gdata module can be used. See my blogpost