Publications by richierocks
Oh (de)bugger!
By number of questions asked, R passed MATLAB for the first time on Stack Overflow today. Thus it seems an appropriate time to write my first R-based post. This post concerns what to do when your R-code goes pear shaped. Back in June there were a couple of very good videos on R debugging that came out of an R meetup in New York. Jay Emerson ...
4910 sym 16 img
Sweet bar chart o’ mine
Last week I was asked to visualise some heart rate data from an experiment. The experimentees were clothed in protective suits and made to do a bunch of exercises while various physiological parameters were measured. Including “deep body temperature”. Gross. The heart rates were taken every five minutes over the two and a half hour period...
6230 sym 28 img
Oh (de)bugger! Part II
It’s Friday night, and I recently discovered that adding a dash of Cointreau somewhat enhances a gin and tonic. Consequently, I’m drunk-blogging. Will try not to make too many tpyos. In the first part of this series, I discussed some standard debugging techniques, like the use of the browser function. One of the limitations of browser i...
4232 sym 16 img
Preventing argument use in R
It sounds silly, but sometimes you don’t want to let people use some arguments of a function. The canonical example is write.csv. The function is effectively a wrapper to write.table, but using “,” as the separator and “.” as the decimal. We could implement the function in a really simple way, as simple.write.csv <- function(...) writ...
3646 sym 16 img
Which functions in R base call internal code?
In a recent question on Stack Overflow about speeding up group-by operations, Marek wondered which functions called .Internal code (and consequently were fast). I was surprised to see that there appears to be no built-in way to check whether or not this is the case (though is.primitive is available for primitive functions). Writing such a functi...
1505 sym 16 img
Visualising questionnaires
Last week I was shown the results of a workplace happiness questionnaire. There’s a cut down version of the dataset here, with numbers and wording changed to protect the not-so-innocent. The plots were ripe for a makeover. The ones I saw were 2nd hand photocopies, but I’ve tried to recreate their full glory as closely as possible. To the...
4208 sym R (1307 sym/7 pcs) 28 img
Creating GUIs in R with gWidgets
The gWidgets framework is a way of creating graphical user interfaces in a toolkit independent way. That means that you can choose between tcl/tk, Gtk, Java or Qt underneath the bonnet. There’s also a web-version based upon RApache and ExtJS. Since the code is the same in each case, you can change your mind and swap toolkits at a later date, ...
3990 sym R (1603 sym/11 pcs) 18 img
Trading secrets
Recently I had the opportunity to do a job swap with one of the guys in the laboratory here at HSL. I helped out with the mass-spectrometry and James helped me with the data analysis. Two very useful things came out of this. Firstly, it’s been very informative to see how the data I get is created. I tend to assume that the numbers that ar...
2639 sym 18 img
Adapting graphs for presentations
I’ve just finished reading slide:ology by Nancy Duarte. It contains lots of advice about how to convey meaning through aesthetics. The book has a general/business presentation focus, but it got me wondering about how to apply the ideas in a scientific context. Since graphs from a big part of most scientific talks, and since that’s the bit...
2630 sym R (1011 sym/5 pcs) 26 img
Presenting Immer’s barley data
Last time I talked about adapting graphs for presentations. This time I’m putting some of the concepts I discussed there into action, with a presentation of Immer’s barley dataset. This is a classic dataset, originally published in 1934; in 1993 Bill Cleveland mentioned it in his book Visualising Data on account of how it may contain an e...
1237 sym 18 img