Crimes at street-level; either within a 1 mile radius of a single point, or within a custom area. The street-level crimes returned in the API are only an approximation of where the actual crimes occurred, they are not the exact locations. See the about page (https://data.police.uk/about/#location-anonymisation) for more information about location anonymisation. Note that crime levels may appear lower in Scotland, as only the British Transport Police provide this data.

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

Arguments

lat

latitude of the requested crime area

lng,

longitude of the requested crime area

date,

Optional. (YYY-MM), limit results to a specific month. The latest month will be shown by default. e.g. date = "2013-01"

...

further arguments passed to or from other methods. For example, verbose option can be added with ukp_api("call", config = httr::verbose()). See more in ?httr::GET documentation (https://cran.r-project.org/web/packages/httr/) and (https://cran.r-project.org/web/packages/httr/vignettes/quickstart.html).

Value

a tibble with the columns:

  • category: Category of the crime (https://data.police.uk/docs/method/crime-street/)

  • persistent_id: 64-character unique identifier for that crime. (This is different to the existing 'id' attribute, which is not guaranteed to always stay the same for each crime.)

  • date: Date of the crime YYYY-MM

  • latitude: Latitude

  • longitude: Longitude

  • street_id: Unique identifier for the street

  • street_name: Name of the location. This is only an approximation of where the crime happened

  • context: Extra information about the crime (if applicable)

  • id: ID of the crime. This ID only relates to the API, it is NOT a police identifier

  • location_type: The type of the location. Either Force or BTP: Force indicates a normal police force location; BTP indicates a British Transport Police location. BTP locations fall within normal police force boundaries.

  • location_subtype: For BTP locations, the type of location at which this crime was recorded.

  • outcome_status: The category and date of the latest recorded outcome for the crime

Note

The API will return a 400 status code in response to a GET request longer than 4094 characters. For submitting particularly complex poly parameters, consider using POST instead.

more documentation here: https://data.police.uk/docs/method/crime-street/

Examples

ukp_crime_data <- ukp_crime(lat = 52.629729, lng = -1.131592)
#> No encoding supplied: defaulting to UTF-8.
head(ukp_crime_data)
#> # A tibble: 6 x 12 #> category persistent_id date lat long street_id street_name context id #> <chr> <chr> <chr> <dbl> <dbl> <chr> <chr> <chr> <chr> #> 1 anti-soc… "" 2018… 52.6 -1.13 882346 On or near… "" 6352… #> 2 anti-soc… "" 2018… 52.6 -1.13 883351 On or near… "" 6352… #> 3 anti-soc… "" 2018… 52.6 -1.13 883408 On or near… "" 6352… #> 4 anti-soc… "" 2018… 52.6 -1.13 883313 On or near… "" 6352… #> 5 anti-soc… "" 2018… 52.6 -1.11 882420 On or near… "" 6352… #> 6 anti-soc… "" 2018… 52.6 -1.13 882336 On or near… "" 6352… #> # ... with 3 more variables: location_type <chr>, location_subtype <chr>, #> # outcome_status <chr>