Converts XML documents to lists. Uses the
as_list() function from the
xml2 package but improves its output. As an effect, numbers, dates
and times are converted correctly, unnecessary nested sub-lists with only
element are avoided, and empty XML nodes can be removed altogether. This
makes the resulting list look cleaner and better structured.
XML document to be converted. Can be read in from a file using
xml2's read_xml() function.
cleanup
If TRUE (default) empty XML nodes (with no sub-nodes or
values) will not appear in the list.
convert.types
If TRUE (default) xml_to_list() will try
to infer the data type of value elements in the XML. If FALSE, all
value elements in the resulting list will be of type character.
dec
Decimal separator used in numbers.
thsd
Thousands separator used in numbers.
num.replace
An optional string that will be removed before
xml_to_list() tries to convert values to numbers. Can be used, for
example, to remove currency symbols or other measurement units from values
that are actually numerical.
datetime.formats
A vector of date and/or time formats that will be
used to recognize the respective datatypes. Formats will need to be written
in the general notation used by strftime() and
other standard R functions.