I'm running into a road block here and I can't figure out what I'm
doing wrong. I need to skip over the link if the text equals postseason. The
text is in the second li in the xpaths below in my code. I tried
li[not(.,"postseason")] as I thought that is what I needed to exclude
the postseason link but it doesn't work. This link will show you an example
of want I want to exclude under standard batting > game logs > postseason
http://www.baseball-reference.com/players/j/jeterde01.shtml place this
http://www.baseball-reference.com/players/j/jeterde01.shtml in playerURLs and
you should season the postseason link returned. How can I skip over the
postseason link? Thanks! #GET YEARS PLAYED LINKS
yplist = NULL
playerURLs <-
paste("http://www.baseball-reference.com",datafile17[,c("hrefs")],sep="")
for(thisplayerURL in playerURLs){
doc <- htmlParse(thisplayerURL)
yplinks <- data.frame(
names = xpathSApply(doc,
'//*[@id="all_standard_batting"]/div//ul/li[2]/ul/li/a',xmlValue),
hrefs = xpathSApply(doc,
'//*[@id="all_standard_batting"]/div/ul/li[2]/ul/li/a',xmlGetAttr,'href'))
yplist = rbind(yplist, yplinks)
}
yplist[,c("hrefs")]
[[alternative HTML version deleted]]