require(RCurl)
last.page<-15640
num<-"00"
allposts=NULL
while(as.numeric(num)<=last.page){
forum<-getURL(
paste("https://bitcointalk.org/index.php?topic=85687.",num, sep=""),
ssl.verifypeer = FALSE, useragent = "R"
)
forum<-readLines(tc <- textConnection(forum)); close(tc)
dates1<-grep('',forum)
dates2<-dates1[seq(2,length(dates1),by=2)]
forum2<-forum[dates2]
if(length(grep("edit",forum2))>0){
forum3<-forum2[-grep("edit",forum2)]
}else{
forum3<-forum2
}
dates=NULL
for(i in 1:length(forum3)){
temp<-unlist(strsplit(forum3[i],">"))
date<-strsplit(temp[2],"")[[1]][1]
dates<-rbind(dates,date)
}
allposts<-rbind(allposts,dates)
num<-20 + as.numeric(num)
print(num)
}
rownames(allposts)<-1:length(allposts)
allposts<-allposts[-which(allposts=="
alldates=NULL
for(i in 1:length(allposts)){
temp<-unlist(
strsplit(
unlist(strsplit(allposts[i],", ")),
" "
)
)
temp2<-cbind(temp[1],temp[2],temp[3])
alldates<-rbind(alldates,temp2)
}
alldates<-as.data.frame(alldates)
alldates[,1]<-as.character(alldates[,1])
alldates[,2]<-as.numeric(as.character(alldates[,2]))
alldates[,3]<-as.numeric(as.character(alldates[,3]))
mnth<-month.name[1]
yr<-2012
counts=NULL
for(yr in c(2012,2013)){
for(m in 1:length(month.name)){
mnth<-month.name[m]
temp<-alldates[which(alldates[,1]==mnth & alldates[,3]==yr),]
if(nrow(temp)>0){
for(i in 1:max(temp[,2])){
cnt<-length(which(temp[,2]==i))
counts.temp<-cbind(unique(temp[,1]),i,unique(temp[,3]),cnt)
counts<-rbind(counts,counts.temp)
}
}
}
}
counts<-as.data.frame(counts)
counts[,1]<-as.character(counts[,1])
counts[,2]<-as.numeric(as.character(counts[,2]))
counts[,3]<-as.numeric(as.character(counts[,3]))
counts[,4]<-as.numeric(as.character(counts[,4]))
x.vals<-round(seq(1,nrow(counts), length=10),0)
x.labs<-paste(counts[x.vals,1],counts[x.vals,2], counts[x.vals,3])
plot(counts[,4], type="l", lwd=2, col="Red",
ylab="Number of Posts",xaxt="n", xlab="",
main="Posts per Day in Wall Observer Thread"
)
axis(side=1, at=x.vals, labels=x.labs)