I think that gsub example on help page is more clear: library(XML)
# could be used the XML package to get the names cnames <- gsub('\n', '', head(tail(sapply(getNodeSet(htmlParse(z, asText = TRUE), "//i"), xmlValue), -3), -3)) gsub("(\\w)(\\w*)", "\\U\\1\\L\\2", cnames, perl=TRUE) On Tue, Aug 17, 2010 at 4:44 PM, Brian Diggs <dig...@ohsu.edu> wrote: > Since Peter Dalgaard is splitting his considerable contributions between > "Peter Dalgaard" and "peter dalgaard", I made the following changes (which > shouldn't be a problem unless e e cummings becomes a regular poster): > > # from base::chartr documentation > capwords <- function(s, strict = FALSE) { > cap <- function(s) paste(toupper(substring(s,1,1)), > {s <- substring(s,2); if(strict) tolower(s) else s}, > sep = "", collapse = " " ) > sapply(strsplit(s, split = " "), cap, USE.NAMES = !is.null(names(s))) > } > > cnames <- capwords(sapply(zz[3:(length(zz)-1)],namefun)) > > > > > On 8/17/2010 10:00 AM, Henrique Dallazuanna wrote: > >> Ben, >> >> I change the line: >> >> z<- getURL(paste(baseurl,list,"/", month,"/author.html",sep="")) >> >> to >> >> z<- getURL(paste(baseurl,list,"/", month,"/author.html",sep=""), >> ssl.verifypeer = FALSE) >> >> because don't work for me. >> >> Nice! >> >> On Tue, Aug 17, 2010 at 1:47 PM, Ben Bolker<bbol...@gmail.com> wrote: >> >> month<- "2010-August" >>> list<- "r-help" >>> ##list<- "r-sig-ecology" >>> ##list<- "r-sig-mixed-models" >>> ## month<- "2010q3" >>> n<- 50 >>> baseurl<- "https://stat.ethz.ch/pipermail/" >>> library(RCurl) >>> z<- getURL(paste(baseurl,list,"/",month,"/author.html",sep="")) >>> zz<- strsplit(z,"<LI>")[[1]] >>> namefun<- function(x) { >>> gsub("\\n","",gsub("^.+<I>","",gsub("</I>.+$","",x))) >>> } >>> >>> cnames<- sapply(zz[3:(length(zz)-1)],namefun) >>> rr<- rev(sort(table(cnames))) >>> >>> >>> library(lattice) >>> dotplot(~rev(rr[1:n]),xlab="Number of posts") >>> >>> dotplot(~rev(rr[1:n]),xlab="Number of posts", >>> scales=list(x=list(log=10))) >>> >>> ______________________________________________ >>> R-help@r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >>> >> >> >> > -- > Brian Diggs > Senior Research Associate, Department of Surgery, Oregon Health & Science > University > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.