To view the subscribers of a Vanderbilt email list, you may email
mailto:majordomo@list.vanderbilt.edu. Just put the string "who listname" and end the email body with "END":
who biostat-admin
who biostat-it
END
After a few minutes, you'll receive a reply from majordomo with the subscribers to each list. I want to take the output of all the department lists and reformat it so I can view it from a spreadsheet.
lines=scan(file = "emaillists", what = character(0), sep = "\n")
# alternative way to open a file for reading
# con <- file("emaillists", "r", blocking = FALSE)
# lines=readLines(con)
# close(con)
emails=list() # list to hold email lists and subscribers
allemails=character(0) # vector of unique email addresses
currlist=''
for(i in lines) {
# look for text string 'Members' - this line holds list name
# grep returns either a 1 or an empty integer vector
# using length I can change the value to 1 or 0
if(length(grep("Members",i))) {
# strsplit returns a list - the second element of the first list holds the list name
# save the current list name to use for the addresses that will follow
currlist=strsplit(i,"'")[[1]][2]
# create an empty character vector to hold each email address
emails[[currlist]]=character(0)
}
# any line with a '@' contains an email address
if(length(grep("@",i))) {
emails[[currlist]]=append(emails[[currlist]],i)
allemails=append(allemails,i)
}
}
allemails=unique(allemails[order(allemails)]) # remove duplicate emails
# create a data frame where rows are subscribers and columns are email lists
emailtable=as.data.frame(matrix(data=0,nrow=length(allemails),ncol=length(emails)))
names(emailtable)=names(emails) # set up column names - email lists
row.names(emailtable)=allemails # set up row names - subscribers
# loop through each email list
for(i in names(emails)) {
# set value to '1' where email address is part of a email list
emailtable[emails[[i]],i]=1
}
# save my new output file as a CSV
write.csv(emailtable,'emaillists.csv')
Topic revision: r1 - 30 Aug 2007 - 10:53:01 -
ColeBeck