Pages

Sunday, 27 January 2013

r/Bitcoin statistics

0. Introduction
This is a quick post to chart the pageview, unique visitor and subscription statistics provided by bitcointalk.org forum member, moderator,  and owner of blockexplorer.com,  theymos in this post.

Since it's not an analysis of any sort, I'll provide the R script as well as the charts - if theymos updates the data, you'll be able to generate charts yourself.

1. The charts

2. The script


### reddit/r/Bitcoin stats
require(RJSONIO)
require(reshape)
require(ggplot2)

### change "pasteBinUrl" if theymos updates data
###
pasteBinUrl <- "http://pastebin.com/6kbMAAR3"
###



### functions
date.func <- function(x) ISOdate(1970,1,1)+ x$Unixtime

### download data
uniqueID <-  gregexpr("[1-9]", pasteBinUrl)[[1]]
reddit <- fromJSON(paste("http://pastebin.com/download.php?i=", substr(pasteBinUrl, uniqueID[1], uniqueID[2]), sep=''))

### format data sets for plotting

r.month <- data.frame(do.call(rbind, reddit$month))
r.day <- data.frame(do.call(rbind, reddit$day))
r.hour <- data.frame(do.call(rbind, reddit$hour))

colnames(r.month) <- c("Unixtime", paste(c("Uniques per", "Pageviews per"),"month"))
colnames(r.day) <- c("Unixtime", paste(c("Uniques per", "Pageviews per", "Subscriptions per"),"day"))
colnames(r.hour) <- c("Unixtime", paste(c("Uniques per", "Pageviews per"), "hour"))

#r.day$"Cumulative subscriptions" <- rev(c(cumsum(r.day$Subscriptions)))
r.day$Date <- date.func(r.day); r.month$Date <- date.func(r.month); r.hour$Date <- date.func(r.hour)

plot.df <- rbind(
melt(r.month[, 2:4], id="Date"),
melt(r.day[, 2:5], id="Date"),
melt(r.hour[, 2:4], id="Date")
)


#### the chart
reddit.plot <- ggplot(plot.df, aes(Date, value)) + 
geom_line() + 
facet_wrap(~variable, scales="free", ncol=1) +
ggtitle("r/Bitcoin statistics from theymos' data") + xlab("") + ylab("")
png(paste('reddit', Sys.Date(), '.png',sep=''),height=960*4,width=960*16/9*4/5,res=220)
reddit.plot
dev.off()

#### the end





Donations help give me the time to analyse bitcoin mining related issues and post the results. If you enjoy or find them helpful, please consider a small bitcoin donation:

12QxPHEuxDrs7mCyGSx1iVSozTwtquDB3r



No comments:

Post a Comment

Comments are switched off until the current spam storm ends.