njtierney / ukpolice

:uk: :police_car: R package to pull police data from the uk police data repository :police_car: :uk:
http://ukpolice.njtierney.com/
Other
36 stars 9 forks source link

Knife Crime for stop and search #22

Closed sahilsamgi closed 5 years ago

sahilsamgi commented 5 years ago

I wanted to know how to get stop and search for knife crimes only from your R package.

I am finding it difficult use the R Package to only filter out stop and search for knife crimes or something related to knife crimes.

Can you help me out?

Cheers, Sahil

njtierney commented 5 years ago

Hi there!

Thanks for this - it was a good time to add a new feature for this. I've started adding the stop and search features now (see #23) - if you update ukpolice with:

remotes::install_github("njtierney/ukpolice"

You can run the code below.

Unfortunately I can't see something on knives specifically so far with just a quick random search (see below), but there is a mention of "offensive weapons". Looking at the documentation on the uk police site, https://data.police.uk/docs/method/crime-categories/, it looks like object_of_search is what you might be most interested in.

Hopefully that helps!

library(ukpolice)

stop_search <- ukp_stop_search(lat = 52.629729, lng = -1.131592)
#> No encoding supplied: defaulting to UTF-8.

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
stop_search %>%
  count(object_of_search)
#> # A tibble: 4 x 2
#>   object_of_search             n
#>   <chr>                    <int>
#> 1 Article for use in theft     6
#> 2 Controlled drugs            62
#> 3 Offensive weapons           27
#> 4 Stolen goods                11

stop_search %>%
  count(legislation)
#> # A tibble: 3 x 2
#>   legislation                                                 n
#>   <chr>                                                   <int>
#> 1 Criminal Justice and Public Order Act 1994 (section 60)     2
#> 2 Misuse of Drugs Act 1971 (section 23)                      62
#> 3 Police and Criminal Evidence Act 1984 (section 1)          42

Created on 2019-04-17 by the reprex package (v0.2.1)

njtierney commented 5 years ago

Issue closed as it's progress is described in #23