Git Product home page Git Product logo

nzpullover's Introduction

nzpullover

Travis-CI Build Status AppVeyor Build Status Cran Status Cran Downloads

The nzpullover package makes available road policing data from the New Zealand Police in a convenient ‘tidy’ form. Offence categories include speed, alcohol, red light, restraints (seatbelts), mobile phone, fleeing drivers, and speeding police vehicles.

The original data published by the New Zealand Police is available as a spreadsheet here: http://www.police.govt.nz/about-us/publication/road-policing-driver-offence-data-january-2009-june-2018. Please note that this R package is not associated with the New Zealand Police.

The spreadsheet data has been made tidy by using the tidyxl and unpivotr packages. See the scripts in /data-raw. Zipped csv files are available in /inst/extdata.

The New Zealand Police refresh the data approximately quarterly. If this package lags behind, then please open an issue https://github.com/nacnudus/nzpullover/issues. The CRAN version will be updated annually.

Installation

You can install nzpullover from github with:

# install.packages("devtools")
devtools::install_github("nacnudus/nzpullover")

Example

Scroll to the bottom for lots more graphs.

glimpse(driving_offences)
#> Observations: 62,345
#> Variables: 6
#> $ category <chr> "Red Light", "Red Light", "Red Light", "Red Light", "...
#> $ value    <dbl> 78, 105, 123, 138, 88, 101, 72, 121, 96, 157, 123, 97...
#> $ series   <chr> "Officer issued red light", "Officer issued red light...
#> $ district <chr> "Auckland", "Auckland", "Auckland", "Auckland", "Auck...
#> $ area     <chr> "Auckland Central Area", "Auckland Central Area", "Au...
#> $ month    <date> 2009-01-01, 2009-02-01, 2009-03-01, 2009-04-01, 2009...
glimpse(static_camera)
#> Observations: 5,522
#> Variables: 8
#> $ value    <dbl> 888, 12, 60, 1657, 973, 898, 108, 233, 374, 369, 522,...
#> $ series   <chr> "Static Camera-issued speed offences by site", "Stati...
#> $ district <chr> "AUCKLAND CITY", "AUCKLAND CITY", "AUCKLAND CITY", "A...
#> $ area     <chr> "AUCKLAND EAST AREA", "AUCKLAND EAST AREA", "AUCKLAND...
#> $ site     <chr> "AC0008", "AC0008", "AC0009", "AC0009", "AC0009", "AC...
#> $ road     <chr> "REMUERA ROAD", "REMUERA ROAD", "ELLERSLIE-PANMURE HI...
#> $ section  <chr> "BETWEEN KORAHA STREET AND MEADOWBANK ROAD", "BETWEEN...
#> $ month    <date> 2009-01-01, 2009-02-01, 2009-09-01, 2009-10-01, 2009...
glimpse(excess)
#> Observations: 21,667
#> Variables: 6
#> $ value    <dbl> 27, 84, 109, 66, 17, 3, 4, 1, 1, 65, 178, 85, 37, 8, ...
#> $ series   <chr> "Officer-issued excess speed band", "Officer-issued e...
#> $ district <chr> "Auckland", "Auckland", "Auckland", "Auckland", "Auck...
#> $ area     <chr> "Auckland Central Area", "Auckland Central Area", "Au...
#> $ speed    <chr> "<11", "11-15", "16-20", "21-25", "26-30", "31-35", "...
#> $ month    <date> 2009-12-01, 2009-12-01, 2009-12-01, 2009-12-01, 2009...
glimpse(fleeing_area)
#> Observations: 21,090
#> Variables: 5
#> $ value    <dbl> 0, 0, 0, 10, 11, 4, 8, 4, 7, 6, 3, 2, 0, 0, 0, 3, 7, ...
#> $ series   <chr> "Fleeing driver incidents where Area-level detail is ...
#> $ district <chr> "Auckland", "Auckland", "Auckland", "Auckland", "Auck...
#> $ area     <chr> "Auckland Central Area", "Auckland Central Area", "Au...
#> $ month    <date> 2009-01-01, 2009-02-01, 2009-03-01, 2009-04-01, 2009...
glimpse(fleeing_district)
#> Observations: 6,840
#> Variables: 4
#> $ value    <dbl> 10, 14, 26, 22, 24, 17, 27, 19, 21, 15, 18, 14, 18, 6...
#> $ series   <chr> "Fleeing driver incidents by district", "Fleeing driv...
#> $ district <chr> "Auckland City", "Auckland City", "Auckland City", "A...
#> $ month    <date> 2009-01-01, 2009-02-01, 2009-03-01, 2009-04-01, 2009...
glimpse(police_speeding)
#> Observations: 6,906
#> Variables: 5
#> $ value    <dbl> 2, 4, 3, 1, 1, 2, 4, 1, 6, 1, 1, 1, 2, 1, 1, 1, 1, 3,...
#> $ series   <chr> "Police vehicle speed - detections by speed camera", ...
#> $ district <chr> "Auckland", "Auckland", "Auckland", "Auckland", "Auck...
#> $ area     <chr> "Auckland East", "Auckland East", "Auckland East", "A...
#> $ month    <date> 2009-03-01, 2009-04-01, 2009-05-01, 2009-06-01, 2009...
glimpse(police_speeding_band)
#> Observations: 1,955
#> Variables: 6
#> $ value    <dbl> 15, 4, 1, 1, 2, 1, 6, 1, 1, 9, 2, 3, 2, 1, 1, 2, 11, ...
#> $ series   <chr> "Police vehicle speed detections by calendar year* an...
#> $ district <chr> "Auckland", "Auckland", "Auckland", "Auckland", "Auck...
#> $ area     <chr> "Auckland East", "Auckland East", "Auckland East", "A...
#> $ speed    <chr> "11-15", "16-20", "21-25", "26-30", "31-35", "46-50",...
#> $ year     <date> 2009-01-01, 2009-01-01, 2009-01-01, 2009-01-01, 2009...

Other New Zealand datasets by the same author:

  • nzlifetables – cohort life tables
  • nzcensus2013 – summary statistics from the 2013 New Zealand census
  • nzbabynames – the top 100 baby names annually since 1954, and annual birth statistics.

Lots more graphs

nzpullover's People

Contributors

nacnudus avatar

Stargazers

 avatar  avatar

Watchers

 avatar

nzpullover's Issues

Central district and Manawatu area data does not appear to be accurate

Hi,

I was a Police Medical officer through this period of time. One of my duties was to collect blood samples from drunk drivers who declined to accept the breath test result. I would perform 2-5 blood samples per week and only 1:5 failed breath tests would request blood. So roughly there was 10+ drink or drug drivers per week. Yet this data set records only 238 offences in total or <1/week.

For camera-issued and officer-issued speed tickets n = 186 for both categories. N = 186 also for running red lights and not wearing seat belts (restraints). For four significant categories over such a long time period to have a low number of offences with no variance, seems unlikely given the quality of NZ driving.

This data feels wrong.

Kind regards

Greig

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.