ukc_crime_location: Crimes at a specific location

Description Usage Arguments Details Value Note Examples

View source: R/ukpolice-deprecated.R

Description

Returns details of crimes within a one mile radius of a given point, at a specific location ID, or from within a custom polygon.

Usage

1
2
3
4
5
6
7
ukc_crime_loc(location, date = NULL, ...)

ukc_crime_coord(lat, lng, date = NULL, ...)

ukc_crime_poly(poly_df, date = NULL, ...)

ukc_crime_location(lat, lng, location, date = NULL, ...)

Arguments

location

If specified, lat and lng are ignored. Location IDs are available through other methods including ukc_street_crime().

date

The year and month in "YYYY-MM" form. If NULL, latest available month will be returned. Also accepts dates in formats that can be coerced to Date class with as.Date().

...

further arguments passed to httr::GET.

lat

Latitude. Accepts a single value.

lng

Longitude. Accepts a single value.

poly_df

a dataframe containing the lat/lng pairs which define the boundary of the custom area, or a sf or SpatialPointsDataFrame object. The first and last coordinates need not be the same — they will be joined by a straight line once the request is made. If a dataframe, the lat/lng must be the first two columns, or named "lat" and "lng".

Details

If specified, lat and lng must be the same length. location or both lat and lng must be specified.

Value

A tibble with details of crimes at a given location.

Note

The API will return a 400 status code in response to a GET request longer than 4094 characters.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
x <- ukc_crime_location(lat = 52, lng = 0)

y <- ukc_crime_location(location = 802171)

poly_df_3 <- data.frame(
  lat = c(52.268, 52.794, 52.130),
  lng = c(0.543, 0.238, 0.478)
)

z <- ukc_crime_poly(poly_df_3)

## End(Not run)

ukpolice documentation built on Aug. 3, 2020, 5:09 p.m.