Friday, April 26, 2013

Noam Ross has a great overview of making code go faster in R here, although a lot of the ideas (such as pre-allocation) apply to every language. My own tips are not that dissimilar--a little less complete but more specific.

Thursday, March 14, 2013

Apply-style commands in R

Here's a quick table of what I think are the most useful apply-style commands in R:
FunctionInputOutputBest for
applyRectangularRectangular or vectorApplying function to rows or columns
lapplyAnythingListNon-trivial operations on almost any data type
sapplyAnythingSimplified (if possible) or listSame as lapply, but with simplified output
plyr::ddplydata.framedata.frameApplying function to groupings defined by variables
For alternatives to plyr, see this post on StackOverflow.

Saturday, February 2, 2013

R scripts for analyzing survey data

Another site pops up with open code for analyzing public survey data: http://www.asdfree.com/ It will be interesting to see whether this gets used by the general public--given the growing trend of data journalism and so forth--versus academics. It is a useful resource for both.