Good news for R bloggers who are using WordPress.com to host their blog.
This week, the good people running WordPress.com (special thanks goes to Yoav Farhi), have added the ability for all the users of the WordPress.com platform to be able to highlight their R code inside posts.
Basically you’ll need to wrap the code in your post like this:
[sourcecode language="r"] test.function = function(r) { return(pi * r^2) } test.function(1) [/sourcecode]
(Which will then look like this:
)
Further details (and other supported languages) can be read about on this WordPress.com support page.
This new feature was possible thanks to the work of Yihui Xie (who create the famous cool animation package for R), who created a R syntax brush for the syntaxhighlighter WordPress plugin (the plugin used by WordPress.com for sytnax highlighting)
p.s: If you are a WordPress.org users (e.g: have a self hosted WordPress blog) and want to enable R syntax highlighting for your blog, I would recommend the use of the WP-Syntax plugin (enhanced with GeSHi version 1.0.8.6) which can be downloaded here.