R Style Guide

This is mainly a note to self: There are several style guides for R out there. I particularly like the one from Google and the somewhat lighter version of Hadley (ggplot god). All of that style guide thinking started after a question on  about R workflow … How do we organize large R projects. Hadley (again) is favoring an Load-Clean-Func-Do approach which looks somewhat like that: load.R # load data clean.

Why anybody should learn/use R …

I had a discussion the other day on the re-appearing topic why one should learn R … I took the list below from the R-Bloggers which argues why grad students should learn R: R is free, and lets grad students escape the burdens of commercial license costs. R has really good online documentation; and the community is unparalleled.  The command-line interface is perfect for learning by doing.  R is on the cutting edge, and expanding rapidly.

awesome visualization tool for R

http://cran.r-project.org/web/packages/googleVis/ enables chart generation similar to the ones instroduced by Hans Roesling in his TED talk on poverty – extremly cool 🙂

resinstalling packages in R after update

This is old - by should still work :) - comment on how to do this in 2019 below … The new version 2.13.0 of R has just been released and with the update comes the pain of re-installing all the packages from the old installation on the new one. Stackoverflow to the rescue! This posting provides a simple two step process of first writing a list of packages into a file on the disk in the old version, installing the new version and then comparing the exported list to the currently installed packages in the new version with setdiff.

Psychology as a reproducible Science

Is Psychology ready for reproducible research? Today the typical research process in psychology looks generally like this: we collect data; analyze them in many ways; write a draft article based on some of the results; submit the draft to a journal; maybe produce a revision following the suggestions of the reviewers and editors; and hopefully live long enough to actually see it published. All of these steps are closed to the public except for the last one – the publication of the (often substantially) revised version of the paper.

R and the World Cup

Across the street at the Revolution blog a nice example of using R with data from the cloud (see another post on this topic here) shows us the distribution of fouls during the just finished World Cup in a nice barchart. Even more interesting than the fact that Holland rules this category is the way the data are collected from a Google spreadsheet page. With the following simple code line:

R goes cloud

Jeroen Ooms did for R what Google did for editing documents online. He created several software packages that help running R with a nice frontend over the Internet. I first learned about Jeroen’s website through his implementation of ggplot2 – this page is useful to generate graphs with the powerful ggplot2 package without R knowledge, however it is even more helpful to learn ggplot2 code with the View-code panel function which displays the underlying R code.

Lattice versus ggplot2

I really liked Lattice for generating graphs in R until I saw what ggplot2 can do … One of the big differences between the two is the theory on which ggplot2 is based upon. There are clear modular building blocks that can be applied in a consistent manner on any graph generated. Both packages are extremely versatile but at the end of the day I think ggplot2 provides a clearer structure and hence more flexibility …

R flashmob

From: The R Flashmob Project Subject: R Flashmob #2 You are invited to take part in R Flashmob, the project that makes the world a better place by posting helpful questions and answers about the R statistical language to the programmer’s Q & A site stackoverflow.com Please forward this to other people you know who might like to join. FAQ Q. Why would I want to join an inexplicable R mob?

Inference and R

Dan Goldstein posted a short overview of Inference which allows working with R code in Microsoft Office and Excel. I want to point at Sweave which does an excellent job in connecting R to LaTeX. Here is a short demo of Sweave which also connects the approach of Sweave to the ‘literate programming‘ idea of Donald Knuth (Father of ‘The Art of Computer Programming’ and TeX). The basic idea is to combine programming (an analysis in the case of R) with documentation into one process.