xpath - Correct syntax for xpathSApply in R -
xpath - Correct syntax for xpathSApply in R -
i'm struggling statistics table on website in dataframe analysis on it. table found here: http://nl.soccerway.com/teams/netherlands/afc-ajax/1515/squad/
my code far:
library(xml) url <- "http://nl.soccerway.com/teams/netherlands/afc-ajax/1515/squad/" doc <- htmlparse(url) xpathsapply(doc, "//tr[@*]/td/child::node()", xmlvalue)
but returns info in unworkable form. right xpathsapply code?
the table info has id='page_team_1_block_team_squad_3-table'
can utilize in xpath. xpath "//table[@id='page_team_1_block_team_squad_3-table']/tbody"
find table id , homecoming table body. can utilize readhtmltable
argument header = false
homecoming data
library(xml) url <- "http://nl.soccerway.com/teams/netherlands/afc-ajax/1515/squad/" doc <- htmlparse(url) res <- readhtmltable(doc["//table[@id='page_team_1_block_team_squad_3-table']/tbody"][[1]], header = false) head(res) > head(res) v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 1 1 k. vermeer 28 k 856 10 10 0 1 24 0 0 0 0 2 22 j. cillessen 25 k 2204 25 24 1 0 8 0 0 0 0 3 30 m. van der hart 20 k 0 0 0 0 0 2 0 0 0 0 4 2 r. van rhijn 23 v 2786 32 31 1 1 1 2 3 6 0 5 3 t. alderweireld 25 v 360 4 4 0 0 0 0 0 0 0 6 4 n. moisander 28 v 1985 23 22 1 0 3 1 2 0 0 v17 1 0 2 0 3 0 4 1 5 0 6 0
r xpath html-parsing
Comments
Post a Comment