Publishing R Statistics directly in WordPress

© 2016 The R Foundation (CC-BY-SA 4.0)

© 2016 The R Foundation (CC-BY-SA 4.0)

This post is an experiment: Writing a program in R and publishing directly the results into WordPress. This experiment is part of my ongoing effort of the last few months to collect material for a new book. I want to describe new working procedures in scientific research which are — thanks to progress in digitalization like open source tools, open data — now feasible. My focus on these new work flows are guided on the one hand by the goal to improve reproducibility of all research phases and on the other hand to facilitate research procedures in closing the digital gaps between different research tasks.

Co-operation between RWordPress and knitr

I am using a special the R package RWordPress. This is a package for publishing blog posts from R to WordPress. The package bridges the gap between R as a free software environment for statistical computing and graphics with the likewise open source website and blogging tool WordPress. I will explain the procedure in R in another post with more details, but to get an overview have a look at this page by Yihui Xie.

Data from Gapminder.org

For the demonstration, I am using data from Gapminder.org. Following is a quote from the Gapminder-about-page:

Gapminder is an independent Swedish foundation with no political, religious or economic affiliations. Gapminder is a fact tank, not a think tank. Gapminder fights devastating misconceptions about global development. Gapminder produces free teaching resources making the world understandable based on reliable statistics. Gapminder promotes a fact-based worldview everyone can understand. Gapminder collaborates with universities, UN, public agencies and non-governmental organizations.

Publishing a table without R code

Show the median of life expectancy per continent in 2007.

  continent lifeExp
1    Africa 47.7920
2  Americas 67.0480
3      Asia 61.7915
4    Europe 72.2410
5   Oceania 73.6650

Publishing a graph with R code

Show the life expectancy of Rwanda.


> plot(lifeExp ~ year, gapminder, subset = country == "Rwanda", type = "b")

plot of chunk gapminder-demo1

Bubble plot for lots of countries

Different bubbles for different countries. The size of the bubbles represents the population.

plot of chunk gapminder-demo2

Flattr this!

Verschlagwortet mit , , , , . Bookmark the permalink.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Time limit is exhausted. Please reload CAPTCHA.