Description Usage Arguments Details Value Source See Also Examples
View source: R/get_food_report.R
Retrieve food reports from the USDA Food Compositions Data Base.
1 2 | get_food_report(api_key = NULL, ndbno = NULL, type = "b",
result_type = "json")
|
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
|
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. |
This uses Food Reports API Version 2
An object as per the requested format.
https://ndb.nal.usda.gov/ndb/doc/apilist/API-FOOD-REPORTV2.md
get_nutrients
pretty_xml
get_nutrient_info
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.