GithubHelp home page GithubHelp logo

rksgis / crossfire Goto Github PK

View Code? Open in Web Editor NEW

This project forked from voltdatalab/crossfire

0.0 0.0 0.0 121 KB

R package about shootings reported in Fogo Cruzado app, in Rio de Janeiro and Recife

Python 53.86% R 46.14%

crossfire's Introduction

hexagon crossfire

crossfire

crossfire is a package created to give easier access to the datasets of the project Fogo Cruzado, which is a digital collaboration platform to register gun shootings in the metropolitan areas of Rio de Janeiro and Recife.

The package facilitates data extraction from the project open-data API, developed by Volt Data Lab.

Please note that as of Nov. 2020, due to changes in Fogo Cruzado's API, user's should update crossfire to its' 0.2.0 version. The get_fogocruzado() function from the 0.1.0 version returns errors and cannot be used.

Installing and loading the package

Currently, the crossfire package can be installed directly from its GitHub repository:

if (!require("devtools")) install.packages("devtools")
devtools::install_github("voltdatalab/crossfire")

library(crossfire)

Functions

crossfire has 3 functions: fogocruzado_signin, get_fogocruzado and get_cities.

  • fogocruzado_signin is used to give access to Fogo Cruzado's API. To access Fogo Cruzado's API, users should be registered and insert their e-mail and password for authentication. Thus, the function registers these information on the current R session, so that it can be used to obtain the Bearer token to extract data using the API.

  • get_fogocruzado extracts slices or the whole dataset of shootings registered by Fogo Cruzado. The function returns a data frame, in which each line corresponds to a shooting registered and its information. It can also filter the data according to some parameters, city/state - city and state -, initial and final date - initial_date and final_date -, and the presence of security forces - security_agent. One should note that each request using the crossfire package needs to be under a 210 days (roughly 7 months) time interval, from any portion of the full dataset.

# Extract data for all registered shootings
fogocruzado_all <- get_fogocruzado()

# Extract data for shootings in the cities of Rio de Janeiro and Recife in 2018
fogocruzado_rj_recife <- get_fogocruzado(city = c("Rio de Janeiro", "Recife"),
                                         initial_date = "2018-07-01", final_date = "2018-12-31")

# Extract data from occurents reported by the police and in which security agents were present
fogocruzado_security <- get_fogocruzado(security_agent = 1, source = 2)
  • get_cities() returns a data.frame with information about all cities from the Rio de Janeiro and Recife metropolitan areas covered by the Fogo Cruzado initiative.

More information

For more information on how the package works and for a complete list of functions, see the vignettes (in English and Portuguese).

Authors

Lucas Gelape, for Volt Data Lab.

Contributors

Sérgio Spagnuolo and Denisson Silva.

crossfire's People

Contributors

lgelape avatar felipesbarros avatar sergiospagnuolo avatar rksgis avatar

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.