Skip to content

Instantly share code, notes, and snippets.

@michaelbarton
Created March 6, 2012 19:29
Show Gist options
  • Save michaelbarton/1988482 to your computer and use it in GitHub Desktop.
Save michaelbarton/1988482 to your computer and use it in GitHub Desktop.
#!/usr/bin/env Rscript
library(lubridate)
library(plyr)
library(ggplot2)
split.out <- function(string,split.at,position){
sort(unlist(strsplit(string,split.at)))[[position]]
}
d <- ddply(read.csv('results.csv'), .(Identifiers), function(x){
data.frame(
date = ceiling_date(as.Date(
(split.out
(split.out
(paste
(unlist(x['Properties'])),
'\\|',2),
':',1)), "%Y/%m/%d"),"year"),
authors = length
(unlist
(strsplit
(paste(unlist(x['Description'])),', ')))
)
})
p <- ggplot(d,aes(x=as.factor(date),y=authors))
p <- p + stat_boxplot()
png('author_vs_year.png')
print(p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment