I want to scrape the "Team Per Game Stats" table on http://www.basketball-reference.com/leagues/NBA_1996.html, I've tried the following code
webpage <- getURL("http://www.basketball-reference.com/leagues/NBA_1996.html")
tables <- readHTMLTable(webpage)
I've also tried to parse it
webpage <- getURL("http://www.basketball-reference.com/leagues/NBA_1996.html")
webpage <- readLines(tc <- textConnection(webpage))
pagetree <- htmlTreeParse(webpage, useInternalNodes = TRUE)
xpathApply(pagetree, "//table", xmlValue)
Both codes only give me the two tables under "Division Standings", whereas there should be more than 10 tables on that webpage.
Also, when I search "//table[@id='team-stats-per_game']
" under inspect element on the webpage, it leads me right to the table I want, but R returns NULL
when I try to find the same table with xpathApply
.
what am I missing here? Thanks in advance.