MyNixOS website logo
Description

Download Data on UK Police and Crime.

Downloads data from the 'UK Police' public data API, the full docs of which are available at <https://data.police.uk/docs/>. Includes data on police forces and police force areas, crime reports, and the use of stop-and-search powers.

License:MIT Travis buildstatus AppVeyor buildstatus Coveragestatus CRAN_Status_Badge GitHubtag DOI

ukpolice

The ukpolice package downloads data from the UK Police public data API, the full docs of which are available at https://data.police.uk/docs/. Data is available on police forces, crimes, policing areas and stop-and-search.

ukpolice is on CRAN, which you can download using:

install.packages("ukpolice")

You can install the development version of ukpolice from github with:

# install.packages("devtools")
devtools::install_github("evanodell/ukpolice")

Data is available on police forces, crimes, policing areas and stop-and-search. All functions begin with ukc_.

The example below queries stop and searches by the Thames Valley Police in December 2018, and plots them by police-reported ethnic group.

library(ukpolice)
library(ggplot2)
library(dplyr)

tv_ss <- ukc_stop_search_force("thames-valley", date = "2018-12")

tv_ss2 <- tv_ss %>% 
  filter(!is.na(officer_defined_ethnicity) & outcome != "" ) %>%
  group_by(officer_defined_ethnicity, outcome) %>%
  summarise(n = n()) %>%
  mutate(perc = n/sum(n))

p1 <- ggplot(tv_ss2, aes(x = outcome, y = perc,
                             group = outcome, fill = outcome)) + 
  geom_col(position = "dodge") + 
  scale_y_continuous(labels = scales::percent,
                     breaks = seq(0.25, 0.8, by = 0.25)) + 
  scale_x_discrete(labels = scales::wrap_format(15)) + 
  theme(legend.position = "none", axis.text.x = element_text(size = 7)) + 
  labs(x = "Outcome", 
       y = "Percentage of stop and searches resulting in outcome",
       title = "Stop and Search Outcomes by Police-Reported Ethnicity",
       subtitle = "Thames Valley Police Department, December 2018",
       caption = "(c) Evan Odell | 2019 | CC-BY-SA") + 
  facet_wrap(~officer_defined_ethnicity)

p1

For more details, see the package vignette vignette and function documentation.

Meta

Please note that the ‘ukpolice’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

The UK Police API is operated by the UK Government’s Home Office. The ukpolice package is not affiliated with the Home Office. All data accessed through ukpolice is licenced with Open Government Licence v3.0.

Get citation information for ukpolice in R with citation(package = 'ukpolice'), or use the citation information below:

Odell E, Tierney N (2019). ukpolice: Download Data on UK Police and Crime. doi: 10.5281/zenodo.2619537, R package version 0.1.4.9000, URL: https://github.com/evanodell/ukpolice.

A BibTeX entry for LaTeX users is:

  @Manual{,
    title = {{ukpolice}: Download Data on UK Police and Crime},
    author = {Evan Odell and Nicholas Tierney},
    year = {2019},
    note = {R package version 0.1.4.9000},
    doi = {10.5281/zenodo.2619537},
    url = {https://github.com/evanodell/ukpolice},
  }
Metadata

Version

0.2.2

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows