Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Continuous Integration via GitHub Actions #21

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
^\.Rproj\.user$
out
R/deprecated.R$
.travis.yml
^\.travis.yml$
^\.github
40 changes: 40 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Run CI for R using https://eddelbuettel.github.io/r-ci/

name: ci

on:
push:
pull_request:

env:
USE_BSPM: "true"
_R_CHECK_FORCE_SUGGESTS_: "false"

jobs:
ci:
strategy:
matrix:
include:
- {os: macOS-latest}
- {os: ubuntu-latest}

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2

- name: Bootstrap
run: |
curl -OLs https://eddelbuettel.github.io/r-ci/run.sh
chmod 0755 run.sh
./run.sh bootstrap

- name: Dependencies
run: ./run.sh install_all

- name: Test
run: ./run.sh run_tests

#- name: Coverage
# if: ${{ matrix.os == 'ubuntu-latest' }}
# run: ./run.sh coverage
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ Depends: R (>= 2.10)
LazyData: true
Imports: utils, dplyr, seasonal, ggplot2, data.table, zoo, x13binary
Suggests: knitr, rmarkdown
URL: https://github.com/eddelbuettel/gunsales
BugReports: https://github.com/eddelbuettel/gunsales/issues
VignetteBuilder: knitr
RoxygenNote: 5.0.1
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Analysis of NICS gun purchase background checks

[![Build Status](https://travis-ci.org/NYTimes/gunsales.svg)](https://travis-ci.org/NYTimes/gunsales) [![License](http://img.shields.io/badge/license-Apache%20%28=%202%29-brightgreen.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![CRAN](http://www.r-pkg.org/badges/version/gunsales)](https://cran.r-project.org/package=gunsales) [![Downloads](http://cranlogs.r-pkg.org/badges/gunsales?color=brightgreen)](http://www.r-pkg.org/pkg/gunsales)
[![Build Status](https://github.com/eddelbuettel/gunsales/actions/workflows/ci.yaml/badge.svg)](https://github.com/eddelbuettel/gunsales/actions/workflows/ci.yaml)
[![License](https://img.shields.io/badge/license-Apache%20%28=%202%29-brightgreen.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
[![CRAN](https://www.r-pkg.org/badges/version/gunsales)](https://cran.r-project.org/package=gunsales)
[![Downloads](https://cranlogs.r-pkg.org/badges/gunsales?color=brightgreen)](https://www.r-pkg.org/pkg/gunsales)

Statistical analysis of monthly background checks of gun purchases for the New York Times story [What Drives Gun Sales: Terrorism,
Obama and Calls for Restrictions](http://www.nytimes.com/interactive/2015/12/10/us/gun-sales-terrorism-obama-restrictions.html?).
Obama and Calls for Restrictions](https://www.nytimes.com/interactive/2015/12/10/us/gun-sales-terrorism-obama-restrictions.html?).

### Pre-requisites

Expand Down Expand Up @@ -52,12 +55,12 @@ to create, respectively, plots via R base or

### Data issues

The source data comes from the [FBI's National Instant Criminal Background Check System](https://www.fbi.gov/about-us/cjis/nics), and was converted from the original [PDF format](https://www.fbi.gov/file-repository/nics_firearm_checks_-_month_year_by_state_type.pdf) to CSV using [Tabula](http://tabula.technology/).
The source data comes from the [FBI's National Instant Criminal Background Check System](https://www.fbi.gov/about-us/cjis/nics), and was converted from the original [PDF format](https://www.fbi.gov/file-repository/nics_firearm_checks_-_month_year_by_state_type.pdf) to CSV using [Tabula](https://tabula.technology/).

BuzzFeed also released the same dataset on [Github](https://github.com/BuzzFeedNews/nics-firearm-background-checks/) last week.

#### Getting gun sales estimates from background checks

To convert background checks into estimated sales, we relied on a method suggested in the [Small Arms Survey](http://www.smallarmssurvey.org/fileadmin/docs/F-Working-papers/SAS-WP14-US-Firearms-Industry.pdf) by Jurgen Brauer, a professor at Georgia Regents University. Each long gun and handgun check was counted as 1.1 sales. Each multiple-gun check was counted as two sales. Permit checks and other types of checks were omitted. The multiplier is an estimate based on Mr. Brauer's interviews with gun shop owners.
To convert background checks into estimated sales, we relied on a method suggested in the [Small Arms Survey](https://www.smallarmssurvey.org/fileadmin/docs/F-Working-papers/SAS-WP14-US-Firearms-Industry.pdf) by Jurgen Brauer, a professor at Georgia Regents University. Each long gun and handgun check was counted as 1.1 sales. Each multiple-gun check was counted as two sales. Permit checks and other types of checks were omitted. The multiplier is an estimate based on Mr. Brauer's interviews with gun shop owners.

Note: In our computation, we excluded background checks for the "multiple" category in California because they followed an unusual pattern that did not match California gun sales data.