# Blog Archives

## 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,

## R Function Usage Frequencies, Take 2

December 8, 2009
By

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

## 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

## R Function Usage Frequencies

December 7, 2009
By

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

## The Top Scores for Canabalt, Take 2

November 15, 2009
By

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

## Canabalt

November 12, 2009
By

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

## 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...

## 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...

## American Immigration Trends

March 22, 2009
By

The New York Times has a beautiful visualization of immigration trends in the United States since 1880. I highly recommend spending a few minutes playing with the interactive display.

## Causation’s Mistreated Sibling Correlation

March 6, 2009
By

This is why I love XKCD, though surely the best part of this strip was the mouseover: “correlation doesn’t imply causation, but it does waggle its eyebrows suggestively and gesture furtively while mouthing, ‘look over there’.”