Package 'cocktailApp'

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

Help Index


Shiny app to discover cocktails.

Description

Shiny app to discover cocktails.

Legal Mumbo Jumbo

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.

Note

This package is maintained as a hobby.

Author(s)

Steven E. Pav [email protected]


cocktailApp .

Description

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.

Usage

cocktailApp(page_title = "Drink Schnauzer", enableBookmarking = "url")

Arguments

page_title

an optional page title for the app. A NULL value causes no page title to be used.

enableBookmarking

Can be one of "url", "server", or "disable". This is equivalent to calling the enableBookmarking() function just before calling shinyApp(). With the default value (NULL), the app will respect the setting from any previous calls to enableBookmarking(). See enableBookmarking() for more information.

Value

Runs the shiny app.

Screenshots

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.

Screenshot: landing page of app

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.

Screenshot: landing page of app, with selected cocktails

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.

Screenshot: bar plot of ingredients

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.

Screenshot: ternary plot of ingredients

In this screenshot, the user has checked the “Hobson's Choice” box, which adds 5 random cocktails to the cocktail table.

Screenshot: main page with Hobsons choice

Author(s)

Steven E. Pav [email protected]

Examples

## Not run: 
cocktailApp()

## End(Not run)

News for package 'cocktailApp':

Description

News for package ‘cocktailApp’

cocktailApp Version 0.2.2 (2021-04-01)

  • merge many short ingredients.

  • fix some units in webtender data.

  • search by ingredient regex.

cocktailApp Version 0.2.1 (2019-07-01)

  • CRAN fix as tests were hanging.

  • replace Ternary package with ggtern.

cocktailApp Version 0.2.0 (2018-08-19)

  • adding another source.

  • adding “Hobson's Choice” button.

  • removing dependency on ggtern package, replacing with Ternary.

cocktailApp Initial Version 0.1.0 (2018-07-05)

  • first CRAN release.


Cocktails Data

Description

Ingredients of over 26 thousand cocktails, scraped from the web.

Usage

data(cocktails)

Format

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.

Note

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.

Source

Difford's Guide, https://www.diffordsguide.com/, Webtender, https://www.webtender.com, Kindred Cocktails, https://kindredcocktails.com, Drinks Mixer, http://www.drinksmixer.com.

Examples

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)