get_establishments: Get establishments

Description Usage Arguments Details Value Examples

View source: R/get_establishments.R

Description

Fetches a list of establishments

Usage

1
2
get_establishments(name = NULL, la = NULL, type = NULL,
  condensed = TRUE)

Arguments

name

A string to search for within the business name

la

The ID of the required local authority (as returned from 'get_authorities()')

type

The code of the required business type (as returned from 'get_business_types()')

condensed

By default the function returns a selection of variables: to return everything in the API call, set this to FALSE

Details

'get_establishments' makes an API call that returns all establishments, with the ability to filter by name, local authority and business type.

Value

A tibble containing all businesses that meet the specified criteria

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
library(dplyr)
# A list of all restaurants in Aberdeen
# Find the code for Aberdeen
get_authorities() %>%
  filter(grepl("Aberdeen", name))
# Find the code for restaurants
get_business_types()
# Perform establishment search
get_establishments(la = 197, type = 1)

# A list of all businesses containing the words "pret a manger" in Birmingham
# Find out the code for Birmingham
get_authorities() %>%
  filter(grepl("Birmingham", name))
# Perform establishment search
get_establishments(name = "pret a manger", la = 374)

## End(Not run)

helen-food/fhrsdata documentation built on Aug. 21, 2019, 12:22 p.m.