1 upvotes, 1 direct replies (showing 1)
View submission: [Updated] Who runs /r/Holocaust? Each line represents a moderator overlap. [OC]
Gave it a try, but it just said
Loading required package: bitops
for the past 10 minutes or so. Any idea what that means?
Comment by gehanna at 24/07/2014 at 00:50 UTC*
1 upvotes, 0 direct replies
Looks like that's a package that RCurl depends on, so you could try:
install.packages("bitops")
Edit: I had a look, and you should be able to do it in base R if the packages are giving you grief
sub <- "dataisbeautiful" ## Cludge the data together with grep foo <- function(x) readLines(url(x),warn=FALSE) moddata <- foo(paste("http://api.reddit.com/r/",sub,"/about/moderators",sep="")) modlist <- gsub('(.*)\\", \"id.*',"\\1",strsplit(moddata,'name\": \"')[[1]][-1]) sublist <- lapply(as.list(paste("http://www.reddit.com/user/",modlist,sep="")),foo) getsubs <- function(txt) { txt <- paste(txt,collapse="") txt <- gsub('.*<ul id="side-mod-list"(.*?)</ul>.*',"\\1",txt) txt <- gsub("(.*?)/.*","\\1",strsplit(txt,"a href=\"/r/")[[1]][-1]) txt } sublist <- lapply(sublist,getsubs) ## Summarise sumsubs <- table(unlist(sublist,F,F)) sumsubs <- sumsubs[sumsubs>1 & names(sumsubs)!=sub] sumsubs <- data.frame(sub=names(sumsubs),n=sumsubs) rownames(sumsubs) <- NULL sumsubs