XML2R {XML2R} | R Documentation |
Parse XML files into (a list of) matrices or data frame(s)
Description
This function is an experimental wrapper around XML2Obs. One should only use this function over XML2Obs if keys already exist in the XML data and ancestory doesn't need to be altered.
Usage
XML2R(urls, xpath, df = FALSE)
Arguments
urls |
character vector or list of urls that point to an XML file (or anything readable by xmlParse). |
xpath |
XML XPath expression that is passed to getNodeSet. If missing, the entire root and all descendents are captured and returned (ie, tables = "/"). |
df |
logical. Should matrices be coerced into data frames? |
Value
Returns list with one element for each relevant XML node. Each element contains a matrix by default.
See Also
urlsToDocs, docsToNodes, nodesToList, listsToObs
Examples
## Not run:
urls2 <- c("http://gd2.mlb.com/components/game/mlb/year_2013/mobile/346180.xml",
"http://gd2.mlb.com/components/game/mlb/year_2013/mobile/346188.xml")
dat3 <- XML2R(urls2)
cens <- "http://www.census.gov/developers/data/sf1.xml"
census <- XML2R(cens)
## End(Not run)
[Package XML2R version 0.0.8 Index]