This repository was archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
103 lines (74 loc) · 4.46 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
output:
md_document:
variant: markdown_github
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
yummlyr
=====
[](https://travis-ci.org/RomanTsegelskyi/yummlyr)
[](https://ci.appveyor.com/project/RomanTsegelskyi/yummlyr)
[](http://codecov.io/github/RomanTsegelskyi/yummlyr?branch=master)
[](http://cran.r-project.org/package=yummlyr)
R package with bindings for [Yummly API](developer.yummly.com)
NOTE: Neither this package or its author is affiliated Yummly.
Installation
============
To install the release version of `yummlyr` from CRAN:
```R
install.packages('yummlyr')
```
To get the development version from Github:
```R
devtools::install_github("RomanTsegelskyi/yummlyr")
```
Usage
=====
First of all, obtain API credentials from [Yummly.com](https://developer.yummly.com/). After that you can use `save_yummly_credentials()` to persist the application ID and application key between queries, or supply them directly to `search_recipes()` and `get_recipe()` functions.
Search Recipes
--------------
`search_recipes()` function corresponds to [Search Recipes API call](https://developer.yummly.com/documentation#) and is used to search for recipes fitting certain criterias. [Example search response](https://developer.yummly.com/wiki/search-recipes-response-sample). The simplest call looks like this:
```R
search_recipes('bacon')
```
YummlyR supports wide variety of criteria:
* `require_pictures`: if `TRUE`, only to return recipes with photos.
* `allowed_ingredient`: ingredient that all search results must include.
* `excluded_ingredient`: ingredient that all search results should not contain.
* `allowed_diet`: search results will only include recipes whose ingredients are allowed for that diet.
* `allowed_allergy`: only include recipes whose ingredients are allowed for that allergy.
* `allowed_cuisine`: search results will only include recipes with that cuisine.
* `excluded_cuisine`: search results will only exclude recipes with that cuisine.
* `allowed_course`: search results will only include recipes with that cuisine.
* `excluded_course`: search results will only exclude recipes with that cuisine.
* `excluded_holiday`: search results will only exclude recipes with that holiday.
* `max_total_time`: search for recipes that do not exceed a specified max total cook + prep time in seconds
* `max_results`: number of results to return.
* `start`: start with specific result in search.
* `nutrition`: set the range of allowed values for a given nutrition attribute (see below for the list of supported nutrition attributes) by setting a min and/or a max.
* `flavor`: set the ranges for taste attributes (this corresponds to the taste sliders on the Yummly.com search page). The values of min and max are between 0 and 1.
* `facet_field`: facet counts for ingredient and diet. When this parameter is called, the response will include a facetCounts object that lists the matching diets or ingredients and how many results match each diet or ingredient.
For example,
```
search_recipes("onion soup", allowed_ingredient = "bacon")
```
will return onion soup recipes that contain bacon. More detailed expanations of Yummly's Search API with example can be found [here](https://developer.yummly.com/documentation#).
**Note** that allowed values for `ingeredient`, `diet`, `allergy`, `cuisine`, `course`, `holiday`, `nutrition` and `flavor` are defined by [Yummly.com metadata](https://developer.yummly.com/documentation#Metadata) and saved inside the package for convenience. Available metadata can be accessed with `get_metadata()`:
```R
get_metadata('holiday')
```
This returns a `data.frame` with information about available `holiday` keywords.
Get Recipe
-------
Fetch a recipe by its ID. [Example recipe response](https://developer.yummly.com/wiki/get-recipe-response-sample). For example:
```R
get_recipe("French-Onion-Soup-The-Pioneer-Woman-Cooks-_-Ree-Drummond-41364")
```
This returns detailed information about [French Onion Soup French Onion Soup](http://www.yummly.com/recipe/French-Onion-Soup-1332461).