I would like to analyze XML data from MLB's website. I do the following
steps: 

library(XML) 
dat<-"http://gd2.mlb.com/components/game/mlb/year_2007/month_05/day_02/gid_2007_05_02_arimlb_lanmlb_1/inning/inning_1.xml";
 
example<- xmlTreeParse(dat, useInternalNodes=T) 
ex<-xpathApply(example, "//inning", xmlToList)      #could also use
"//atbat" 

This brings information from the first inning of the Arizona/LA game played
on 5/2/2007 into R. 
Now that I have it in R, I don't understand how to 'get at' the data. For
example, how could I calculate the average start speed (
[[1]]$top$atbat$pitch["start_speed"] ) of all pitches thrown in the inning? 

Thanks, 
Skyler 
-- 
View this message in context: 
http://old.nabble.com/Analyzing-XML-data-tp26483962p26483962.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to