XML2R: Parse XML files into (a list of) matrices or data frame(s)

Description Usage Arguments Value See Also Examples

View source: R/XML2R.R

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

1
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

1
2
3
4
5
6
7
8
9
## 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)

cpsievert/XML2R documentation built on May 13, 2019, 10:54 p.m.