Blog Archives

R Function Usage Frequencies, Addendum

December 9, 2009
By

Since people have asked, here is a GitHub page with all of the code used to generate my R function usage analyses: cran-function-usage-analysis.

Read more »

Abstract Data Type Operations in R

December 9, 2009
By

This morning, I got a chance to read enough of the R Language Definition to finish my implementations of push and pop. While I was at it, I also wrote implementations of unshift, shift, queue and dequeue. Here they are: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 push <- function(vector, item) { vector.lvalue.symbol <- substitute(vector) new.expression <- paste(vector.lvalue.symbol,

Read more »

R Function Usage Frequencies, Take 2

December 8, 2009
By
R Function Usage Frequencies, Take 2

Yesterday, Hadley Wickham commented on my post on the frequency of calling various R functions that it would be helpful to have the number of packages that call a function in addition to the number of times that the function is called. I compiled the relevant data last night: you can grab it here This

Read more »

Implementing Push and Pop in R

December 7, 2009
By

Having grown up with Perl, there are two functions that I desperately miss while programming in R: push and pop. Continually writing 1 vector <- c(vector, new.entry) tries my patience, while writing 1 2 vector <- rep(NA, inscrutable.constant) vector <- new.entry makes me feel like I’m programming in C, rather than a higher-level programming language. That said, here’s a simplistic hack to provide

Read more »

R Function Usage Frequencies

December 7, 2009
By
R Function Usage Frequencies

A few months ago I decided to apply word frequency analysis ideas to R code. My idea was simple: the functions that one should invest the most effort into learning are precisely those functions that are used most frequently in real world code. In fact, this simple idea can be applied to spoken languages as

Read more »

The Top Scores for Canabalt, Take 2

November 15, 2009
By
The Top Scores for Canabalt, Take 2

Introduction As promised on Thursday, here’s my second pass at a statistical analysis of Canabalt scores. There are some useful results I’ll present right at the start, and then there are some results that are more or less worthless, except that working through my own mistakes helped me to think more clearly about statistical modeling in

Read more »

Canabalt

November 12, 2009
By
Canabalt

At the office today, I got into a discussion with two of my fellow graduate students about the distribution of scores you can get while playing Canabalt. Because (1) the layout of the levels in the game is fully randomized and (2) the difficulty of certain actions (specifically jumping through windows) is exceptionally high, we

Read more »

The Second Coming

June 18, 2009
By

Pew Research has found that 79% of Americans believe in The Second Coming of Jesus. What worries me more is not that 4 out of 5 Americans believe in The Second Coming, but that 1 out of 5 believes it will happen in their lifetime. It seems inevitable t...

Read more »

The Second Coming

June 18, 2009
By

Pew Research has found that 79% of Americans believe in The Second Coming of Jesus. What worries me more is not that 4 out of 5 Americans believe in The Second Coming, but that 1 out of 5 believes it will happen in their lifetime. It seems inevitable that such a belief will grossly warp

Read more »

Marriage and Happiness

April 7, 2009
By

The Pew Research Center just published a piece reviewing their finding that people who are married report significantly greater levels of happiness than those who are unmarried. I always enjoy this result, particularly because of contemporary Western c...

Read more »