GithubHelp home page GithubHelp logo

NA about openpolicing HOT 6 CLOSED

xnoorrr avatar xnoorrr commented on August 30, 2024
NA

from openpolicing.

Comments (6)

janovergoor avatar janovergoor commented on August 30, 2024

what script are you referring to?

from openpolicing.

xnoorrr avatar xnoorrr commented on August 30, 2024

i'm sorry. I was trying to work out this part:

summary_stats <- function(search_conducted, contraband_found) {
n_stops = length(search_conducted)
n_searches = sum(search_conducted)
n_hits = sum(contraband_found)
search_rate = n_searches / n_stops
hit_rate = n_hits / n_searches
return(data.frame(n_stops, n_searches, n_hits, search_rate, hit_rate))
}

basic_summary_statistics_by_race = florida %>%
group_by(driver_race) %>%
do(summary_stats(.$search_conducted, .$contraband_found))
basic_summary_statistics_by_race

from openpolicing.

xnoorrr avatar xnoorrr commented on August 30, 2024

A tibble: 6 x 6

Groups: driver_race [6]

driver_race n_stops n_searches n_hits search_rate hit_rate

1 "" 1345 NA NA NA NA
2 Asian 69112 NA NA NA NA
3 Black 1021743 NA NA NA NA
4 Hispanic 1173182 NA NA NA NA
5 Other 138772 NA NA NA NA
6 White 3017292 NA NA NA NA

from openpolicing.

epierson9 avatar epierson9 commented on August 30, 2024

I assume this is the result of running on FL data? If so, this is happening because the FL data has NAs in the search_conducted/contraband_found columns (because some stops lack that data), so the search and hit counts/rates become NA as well. You probably want to filter those out prior to computing search and hit statistics; this is not necessary for CT, the state used in the tutorial. (Actually, FL has no contraband found data at all, so hit rates will not be computable).

from openpolicing.

xnoorrr avatar xnoorrr commented on August 30, 2024

Ah I was expecting that but assumed I made a mistake with the data because i couldn't imagine there wasn't found any contraband at all. Too bad, i'm going to try some thing else. thanks for your help!

from openpolicing.

epierson9 avatar epierson9 commented on August 30, 2024

Good luck! In case you haven't yet seen it, the data readme will often provide useful tips on specific states (eg, missing data). https://github.com/5harad/openpolicing/blob/master/DATA-README.md

from openpolicing.

Related Issues (2)

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.