19

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.

Shane
  • 98,550
  • 35
  • 224
  • 217
  • I'm glad you asked this. I looked for one for about 15 seconds then got distracted by some other shiny object and forgot to go back and look some more. – JD Long Sep 28 '09 at 14:55

7 Answers7

6

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.

Shane
  • 98,550
  • 35
  • 224
  • 217
  • To get a pdf from asciidoc-file you would need to use a combination of asciidoc and dblatex. Actually asciidoc includes a nice wrapper script that makes it as easy as 'python a2x.py workflow_walkthrough.txt' – learnr Sep 30 '09 at 08:54
3

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.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
3

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.

jangorecki
  • 16,384
  • 4
  • 79
  • 160
3

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

Tal Galili
  • 24,605
  • 44
  • 129
  • 187
  • Thanks for the update, Tal. It looks like these address syntax highlighting, but not interpretation. I'm still looking forward to a wordpress plugin for R code parsing... – Shane Sep 30 '10 at 15:43
  • Thanks Shane. Why do you think such a plugin would be more useful then simply syntax highlighting ? – Tal Galili Oct 02 '10 at 07:09
2

There's a post on Blogistic Reflections blog how he is using Emacs/ESS org-mode to get the HTML export functionality.

learnr
  • 6,479
  • 4
  • 27
  • 23
1

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.

Robert
  • 838
  • 6
  • 8
0

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

Karsten W.
  • 17,826
  • 11
  • 69
  • 103