使用 R 写博客:将 R 嵌入博客文章的简单方法?

发布于 2024-08-06 04:52:14 字数 453 浏览 8 评论 0原文

一个非常好的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

拥抱我好吗 2024-08-13 04:52:14

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.

你げ笑在眉眼 2024-08-13 04:52:14

您可能必须将 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.

美人骨 2024-08-13 04:52:14

我看到你一年前问过这个问题,由于此后有一些更新(与 WordPress 博客相关),我想参考它们。

我就该主题写了两篇文章:

  1. 对于 wordpress.com 托管的博客: R 语法突出显示 WordPress.com 上的博主
  2. 对于 wordpress.org 自托管博客:使用 wp-syntax 插件在您的(WordPress)博客上突出显示 R 语法

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:

  1. For wordpress.com hosted blogs: R syntax highlighting for bloggers on WordPress.com
  2. For wordpress.org self hosted blogs: Highlight the R syntax on your (WordPress) blog using the wp-syntax plugin

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

⒈起吃苦の倖褔 2024-08-13 04:52:14

截至 2014 年 11 月,有一种简单的方法可以从 R 发布博客到托管在 github 页面上的博客。没有数据库,没有本地环境,没有新的管理面板。只需要 Web 浏览器、github 和 R。

  1. Fork Jekyll Now 以部署预配置 Jekyll(静态站点生成器)到您的 github 存储库中。更改新的存储库名称。
  2. 编辑_config.yml设置一些全局变量(在这里你可以设置RSS、Disqus、Google Analytics等)。
  3. 您的博客文章将位于 _posts 目录中。
  4. 使用 R 包 rmarkdownknitrRmd 文件渲染为 md
  5. 将您的 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.

  1. Fork Jekyll Now to deploy pre-configuerd Jekyll (a static site generator) into your github repo. Change new repo name.
  2. Edit _config.yml to set some global variables (here you can setup RSS, Disqus, Google Analytics, etc.).
  3. Your blog posts will be located in _posts directory.
  4. Use R packages rmarkdown or knitr to render your Rmd file to md.
  5. Upload/copy&paste your 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.

凉栀 2024-08-13 04:52:14

有一篇关于 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.

驱逐舰岛风号 2024-08-13 04:52:14

大多数博客软件都有 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.

另类 2024-08-13 04:52:14

为了将 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文