pretty_xml: Process XML data

Description Usage Arguments Value Examples

View source: R/pretty_xml.R

Description

This function is useful if one has requested for the return output to be of xml type in get_nutrients.

Usage

1
pretty_xml(result, tag, target = NULL, return_raw = FALSE)

Arguments

result

An object obtained from get_nutrients with result_type set to xml

tag

An xml tag.

target

Character. Extract certain attributes from processed xml data. Defaults to NULL.

return_raw

Logical. Do you want to get a raw xml file and proceed with processing yourself? Defaults to FALSE.

Value

If default parameters are used, a semi processed xml file is returned. If target is set, xml attributes corrseponding to target are returned.

Examples

1
2
3
4
5
## Not run: 
if(!require(xml2)) require(xml2)
pretty_xml(res,"food")

## End(Not run)

Nelson-Gon/usdandbr documentation built on Jan. 22, 2020, 4:07 a.m.