xmlToDataFrame

0th

Percentile

Extract data from a simple XML document

This function can be used to extract data from an XML document (or sub-document) that has a simple, shallow structure that does appear reasonably commonly. The idea is that there is a collection of nodes which have the same fields (or a subset of common fields) which contain primitive values, i.e. numbers, strings, etc. Each node corresponds to an "observation" and each of its sub-elements correspond to a variable. This function then builds the corresponding data frame, using the union of the variables in the different observation nodes. This can handle the case where the nodes do not all have all of the variables.

Keywords
IO
Usage
xmlToDataFrame(doc, colClasses = NULL, homogeneous = NA, collectNames = TRUE, nodes = list())
Value

  • A data frame.

See Also

xmlParse getNodeSet

Aliases
Examples
f = system.file("exampleData", "size.xml", package = "XML")
 xmlToDataFrame(f, c("integer", "integer", "numeric"))

   # Drop the middle variable.
 z = xmlToDataFrame(f, colClasses = list("integer", NULL, "numeric"))
Documentation reproduced from package XML, version 3.1-1, License: BSD

Community examples

Looks like there are no examples yet.