I've used the XML package successfully to scrap multiple websites, but I'm having trouble creating a data frame from this specific page:
library(XML)
url <- paste("http://ift.tt/1txbGL2", sep = "")
df1 <- readHTMLTable(url)
print(df1)
> print(df1)
$`NULL`
NULL
$`NULL`
NULL
$`NULL`
Player Pos Injury Game Status
1 Dickson, Ed TE thigh Probable
2 Jensen, Ryan C foot Doubtful
3 Jones, Arthur DE illness Out
4 McPhee, Pernell LB knee Probable
5 Pitta, Dennis TE dislocated hip Injured Reserve (DFR)
6 Thompson, Deonte WR foot Doubtful
7 Williams, Brandon DT toe Doubtful
$`NULL`
Player Pos Injury Game Status
1 Anderson, C.J. RB knee Out
2 Ayers, Robert DE Achilles Probable
3 Bailey, Champ CB foot Out
4 Clady, Ryan T shoulder Probable
5 Dreessen, Joel TE knee Out
6 Kuper, Chris G ankle Doubtful
7 Osweiler, Brock QB left shoulder Probable
8 Welker, Wes WR ankle Probable
$`NULL`
etc
If I try to coerce it I get this error:
> df1 <- data.frame(readHTMLTable(url))
Error in data.frame(`NULL` = NULL, `NULL` = NULL, `NULL` = list(Player = 1:7, :
arguments imply differing number of rows: 0, 7, 8, 6, 9, 1, 11, 4, 12, 5, 21, 3, 2, 15
I'd like all of the injury data (PLAYER, POS, INJURY, GAME STATUS) for all of the teams.
Thanks in advance.
No comments:
Post a Comment