Title: | 'shiny' App to Discover Cocktails |
---|---|
Description: | A 'shiny' app to discover cocktails. The app allows one to search for cocktails by ingredient, filter on rating, and number of ingredients. The package also contains data with the ingredients of nearly 26 thousand cocktails scraped from the web. |
Authors: | Steven E. Pav [aut, cre] |
Maintainer: | Steven E. Pav <[email protected]> |
License: | LGPL-3 |
Version: | 0.2.2.001 |
Built: | 2024-10-29 04:32:11 UTC |
Source: | https://github.com/shabbychef/cocktailApp |
Shiny app to discover cocktails.
cocktailApp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
This package is maintained as a hobby.
Steven E. Pav [email protected]
A shiny
app to explore cocktails. The app allows you to enter ingredients
that a cocktail must have, or ingredients that it must not have. One can
filter by number of ingredients, minimum rating, minimum ‘t stat’
(computed as the rating minus the T stat zero all multiplied by the square
root of the number of ratings). One can also search for cocktail by regex.
In the main tab, titled “drinks”, one can find a table with the summaries of matching cocktails. Selecting rows of this table will cause the cocktail table below to be populated with more details on each selected cocktail. Selecting rows will also populate the bar chart in the “plots” tab.
If two or more ingredients are selected, drinks with non-zero quantities of both of these will be shown in a ternary plot in the “tern” tab.
In the “other” tab is a table with common co-ingredients of the selected ingredients. A co-ingredient is an ingredient that commonly occurs with the selected ingredient, as measured by the number of cocktails, and by ‘rho’, which is like a correlation based on the proportion.
A checkbox labelled, “Hobson's Choice” allows you to populate the cocktail table with five random cocktails that meet the numerical filters on number of ingredients, rating, and so on, but which do not meet the ingredient selections. Unselecting and re-selecting the checkbox selects a new set of random cocktails. Note that the random selection is not responsive to changes in the numerical filters.
cocktailApp(page_title = "Drink Schnauzer", enableBookmarking = "url")
cocktailApp(page_title = "Drink Schnauzer", enableBookmarking = "url")
page_title |
an optional page title for the app. A |
enableBookmarking |
Can be one of |
Runs the shiny
app.
The main page looks as follows. In this case the user has selected two ingredients, ‘Benedictine’ and ‘Bourbon’. The user has modified some of the numeric filters resulting in only six cocktails in the cocktail table on the right in the main tab.
In the next screenshot, the user has selected two of the rows of the cocktail table, which causes the ingredients table on the lower right to be populated with the recipes of the selected cocktails. Instead one could click on the linked cocktail names to be taken to the upstream source of the recipe, which is recommended since those pages typically have better instructions.
In the following screenshot, the user has selected two ingredients, ‘Benedictine’ and ‘bourbon’, then clicked on the the main table, then selected the ‘plots’ tab. This shows a bar plot of the proportions of all ingredients in all the selected cocktails.
In this screenshot, the user has selected two ingredients, ‘Benedictine’ and ‘bourbon’, then clicked on the ‘ternary’ tab, which shows a ternary plot of the proportions of cocktails with non-zero proportions of the first two selected ingredients. The third dimension of the ternary plot is ‘other’ ingredients.
In this screenshot, the user has checked the “Hobson's Choice” box, which adds 5 random cocktails to the cocktail table.
Steven E. Pav [email protected]
## Not run: cocktailApp() ## End(Not run)
## Not run: cocktailApp() ## End(Not run)
News for package ‘cocktailApp’
merge many short ingredients.
fix some units in webtender data.
search by ingredient regex.
CRAN fix as tests were hanging.
replace Ternary
package with ggtern
.
adding another source.
adding “Hobson's Choice” button.
removing dependency on ggtern
package, replacing with Ternary
.
first CRAN release.
Ingredients of over 26 thousand cocktails, scraped from the web.
data(cocktails)
data(cocktails)
A data.frame
object with around 117,000 rows and 12 columns. The
data were scraped from four websites: Difford's guide, Webtender, and
Kindred Cocktails, all scraped in late 2017; and Drinks Mixer, scraped in
mid 2018.
The columns are defined as follows:
amt
The numeric amount of the ingredient.
unit
The unit corresponding to the amount.
The most common entry is fl oz
, which is the unit for ‘main’
ingredients.
The second most common entry is garnish
. These two units
account for over 95 percent of the rows of the data.
ingredient
The name of the ingredient. These may have odd
qualifiers, or brand specifications. Some of these qualifications are
stripped out in the short_ingredient
field.
cocktail
The name of the cocktail.
rating
The rating assigned to the cocktail in the upstream database. For some sources, the ratings have been rescaled. Ratings are on a scale of 0 to 5.
upstream_id
An ID code from the upstream source.
url
The upstream URL.
votes
The number of votes in the rating, from the upstream database. Not always available.
added
The date the cocktail was added to the upstream database. Not always available.
src
The source of the cocktail, as listed in the upstream database. Usually not available.
short_ingredient
A shortened form of the ingredient, stripping away some of the qualifiers. This is subject to change in future releases of this package, when a better term extraction solution is found.
proportion
For ingredients where the unit
is fl oz
,
this is the proportion of the given cocktail that consists of the given ingredient. For a given
cocktail, the proportions should sum to one.
The data were scraped from several websites, which falls in a legal gray area. While, in general, raw factual data can not be copyright, there is a difference between the law and a lawsuit. The package author in no way claims any copyright on this data.
Difford's Guide, https://www.diffordsguide.com/, Webtender, https://www.webtender.com, Kindred Cocktails, https://kindredcocktails.com, Drinks Mixer, http://www.drinksmixer.com.
data(cocktails) str(cocktails) require(dplyr) cocktails %>% filter(short_ingredient %in% c('Averna','Bourbon')) %>% group_by(cocktail,url) %>% mutate(isok=n() > 1) %>% ungroup() %>% filter(isok) %>% arrange(desc(rating),cocktail) %>% select(cocktail,ingredient,amt,unit,rating) %>% head(n=8)
data(cocktails) str(cocktails) require(dplyr) cocktails %>% filter(short_ingredient %in% c('Averna','Bourbon')) %>% group_by(cocktail,url) %>% mutate(isok=n() > 1) %>% ungroup() %>% filter(isok) %>% arrange(desc(rating),cocktail) %>% select(cocktail,ingredient,amt,unit,rating) %>% head(n=8)