An API Wrapper for the Bureau of Justice Statistics (BJS)

Drawing heavy influence from 'blscrapeR', this package scrapes crime data from < https://www.bjs.gov/>. Specifically, it scrapes data from the National Crime Victimization Survey which tracks personal and household crime in the USA. The idea is to utilize the 'tidyverse' methodology to create an efficient work flow when dealing with crime statistics.


BuildStatus Project Status: Active – The project has reached a stable, usablestate and is being activelydeveloped.

Drawing heavy influence from library(blscrapeR), this library is meant to be a tidy wrapper around the Bureau of Justice Statistics (BJS) API. The idea is to utilize the ‘tidyverse’ methodology to create an efficient workflow when dealing with crime statistics.

Installation

You can install bjscrapeR from github with:

# install.packages("devtools")
devtools::install_github("dylanjm/bjscrapeR")

Basic Usage

As of right now, the package only comes with one function: ncvs_api(), which queries information from the National Crime Victimization Survey (NCVS). This data comes in two forms: personal and household crime statistics with years available from 1993-2016.

library(bjscrapeR)
 
crime_dat <- ncvs_api(year = 2012, dataset = "personal")
#> Trying BJS Servers...
#> Payload Successful
head(crime_dat, 5)
#> # A tibble: 5 x 23
#>    year weight gender race1R hispanic ethnic1R  ager marital2 hincome
#>   <int>  <dbl>  <int>  <int>    <int>    <int> <int>    <int>   <int>
#> 1  2012  2739.      1      1        2        1     6        3      88
#> 2  2012  2739.      1      1        2        1     6        3      88
#> 3  2012  2232.      2      2        2        2     5        1       2
#> 4  2012  1570.      2      2        2        2     6        1       2
#> 5  2012  3097.      1      1        2        1     7        2      88
#> # ... with 14 more variables: popsize <int>, region <int>, msa <int>,
#> #   direl <int>, notify <int>, weapon <int>, weapcat <int>,
#> #   newcrime <int>, newoff <int>, seriousviolent <int>, injury <int>,
#> #   treatment <int>, vicservices <int>, locationr <int>

News

bjscrapeR 0.1.0

Major Changes

  • ncvs_api() function created to fetch data from BJS
  • ncvs_personal_codebook created as a tidy tibble to describe variables
  • ncvs_personal_codebook created as a tidy tibble to describe variables

Bug Fixes

  • No known bugs at this time

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("bjscrapeR")

0.1.0 by Dylan McDowell, a year ago


https://github.com/dylanjm/bjscrapeR


Report a bug at https://github.com/dylanjm/bjscrapeR/issues


Browse source code at https://github.com/cran/bjscrapeR


Authors: Dylan McDowell [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports readr, dplyr, glue, tibble


See at CRAN