1 upvotes, 1 direct replies (showing 1)
View submission: [Updated] Who runs /r/Holocaust? Each line represents a moderator overlap. [OC]
If you're familiar with R, this is pretty straightforward:
sub <- "dataisbeautiful" # Cludge the data together with grep library(RCurl) moddata <- getURL(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="")),getURL) getsubs <- function(txt) { 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]
For 'dataisbeautiful' we get:
askscience 2 classicalmusic 2 gamedesign 2 photographs 2 photography 2 science 2
Comment by duckvimes_ at 23/07/2014 at 19:02 UTC
1 upvotes, 1 direct replies
If you're familiar with R, this is pretty straightforward:
If you're familiar with R
If
My familiarity with R, unfortunately, is limited to some brief experiments with the Revere program. I'll definitely have to try this out though.