Isaac Petersen
2013-Feb-28 00:14 UTC
[R] Scraping data from website---Error in htmlParse: error in creating parser
I'm trying to scrape football projections from accuscore.com for the
different positions (right now the projections are set to zeros, but that
will change). I can get the QB projections, but I can't get the
projections for any of the other positions (e.g., RB). How can I get the
RB projections?
I'm not sure what the actual website for the RB and other projections is.
When I go to the main website for the football projections (
http://accuscore.com/fantasy-sports/nfl-fantasy-sports/), it displays the
QB projections. When I click on another position (e.g., RB) it displays a
new URL (
http://accuscore.com/fantasy-sports/nfl-fantasy-sports/Rest-of-Season-RB).
When I enter this new URL into the readHTMLTable function, I receive the
following error:
Error in htmlParse("
http://accuscore.com/fantasy-sports/nfl-fantasy-sports/Rest-of-Season-RB/")
:
error in creating parser for
http://accuscore.com/fantasy-sports/nfl-fantasy-sports/Rest-of-Season-RB/
What's going on? Might this have something to do with Javascript? How can
I scrape the RB projections (
http://accuscore.com/fantasy-sports/nfl-fantasy-sports/Rest-of-Season-RB)?
Thanks in advance!
library("XML")
#this works fine (QB projections)
qb <-
readHTMLTable("http://accuscore.com/fantasy-sports/nfl-fantasy-sports/",
header=1)$fantasy_table
#this produces an error (RB projections)
rb <- readHTMLTable("
http://accuscore.com/fantasy-sports/nfl-fantasy-sports/Rest-of-Season-RB",
header=1)$fantasy_table
[[alternative HTML version deleted]]
