get_food_report: Retrieve food reports from the USDA Food Compositions Data...

Description Usage Arguments Details Value Source See Also Examples

View source: R/get_food_report.R

Description

Retrieve food reports from the USDA Food Compositions Data Base.

Usage

1
2
get_food_report(api_key = NULL, ndbno = NULL, type = "b",
  result_type = "json")

Arguments

api_key

A string. A unique api_key obtained after signingup at [NDB](https://ndb.nal.usda.gov/ndb/doc/index#.) If this is not set with set_apikey, then the user can manually set it here.

ndbno

A string. A unique ndb number for a specific food of interest. Use this if nutrients is set to 'NULL'.

type

One of "b", "f" or "s" for basic, full or stats

result_type

A string. One of json or xml depending on the type of format required.

Details

This uses Food Reports API Version 2

Value

An object as per the requested format.

Source

https://ndb.nal.usda.gov/ndb/doc/apilist/API-FOOD-REPORTV2.md

See Also

get_nutrients pretty_xml get_nutrient_info

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
 get_food_report(ndbno = "35193",
result_type = "xml")
get_food_report(ndbno = c("35193","01009"),
               result_type = "xml")
               res<-get_food_report(ndbno = "35193",
               result_type = "xml")
               pretty_xml(res, tag="food", target="type")
               
## End(Not run)

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