Skip to content

Instantly share code, notes, and snippets.

@CerebralMastication
Created May 17, 2010 22:05
Show Gist options
  • Save CerebralMastication/404288 to your computer and use it in GitHub Desktop.
Save CerebralMastication/404288 to your computer and use it in GitHub Desktop.
sampleSize <- 1e6
bigDF <- data.frame(letter1=I(sample(letters, sampleSize, rep=T)),
letter2=I(sample(letters, sampleSize, rep=T)),
b=rnorm(sampleSize),
c=rnorm(sampleSize))
require(sqldf)
system.time(sqldf("select letter1, letter2, avg(b) as b, avg(c) as c from bigDF group by letter1, letter2"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment