search_pop_times: Search an area for popular times.

View source: R/search_pop_times.R

search_pop_timesR Documentation

Search an area for popular times.

Description

Search an area for popular times.

Usage

search_pop_times(
  sw,
  ne,
  radius = 180,
  type = NULL,
  key = Sys.getenv("GOOGLE_KEY"),
  ...
)

Arguments

sw

A numeric vector of length two with the format of c(lat, long) indicating the southwest point of a bounding box. Must be in decimal degrees and EPSG 4326.

ne

A numeric vector of length two with the format of c(lat, long) indicating northeast point of a bounding box. Must be in decimal degrees and EPSG 4326.

radius

The search radius of each grid element in meters.

type

A place type to limit the search to. See API docs for valid place types. Only one type may be specified per search.

key

Your Google Places API key.

Details

The Google Places API searches return a maximum of 60 responses regardless of a search's radius. To accommodate this limitation of the API, a search grid is created with a number of smaller circles with a defined radius via the radius argument. Each cell in the grid uses a single API call. A smaller radius should be used to accommodate denser geographies. The search grid used is saved the the attribute search_grid and can be accessed attr(x, "search_grid").

Examples

sw <- c(42.988690, -71.465834)
ne <- c(42.995119, -71.455745)
manch_bars <- search_pop_times(sw, ne, radius = 200, type = "bar")

JosiahParry/populartimes documentation built on April 18, 2023, 7:07 a.m.