Description Usage Format Details Source Examples
The raw data behind the story "Most Police Don't Live In The Cities They Serve" https://fivethirtyeight.com/features/most-police-dont-live-in-the-cities-they-serve/.
1 |
A data frame with 75 rows representing cities and 8 variables:
U.S. city
Number of police officers serving that city
Percentage of the total police force that lives in the city
Percentage of white (non-Hispanic) police officers who live in the city
Percentage of non-white police officers who live in the city
Percentage of black police officers who live in the city
Percentage of Hispanic police officers who live in the city
Percentage of Asian police officers who live in the city
The dataset includes the cities with the 75 largest police forces, with the exception of Honolulu for which data is not available. All calculations are based on data from the U.S. Census.
The Census Bureau numbers are potentially going to differ from other counts for three reasons:
The census category for police officers also includes sheriffs, transit police and others who might not be under the same jurisdiction as a city's police department proper. The census category won't include private security officers.
The census data is estimated from 2006 to 2010; police forces may have changed in size since then.
There is always a margin of error in census numbers; they are estimates, not complete counts.
Note: Missing values means that there are fewer than 100 police officers of that race serving that city.
See https://github.com/fivethirtyeight/data/tree/master/police-locals
1 2 3 4 5 | # To convert data frame to tidy data (long) format, run:
library(dplyr)
library(tidyr)
police_locals_tidy <- police_locals %>%
pivot_longer(all:asian, names_to = "race", values_to = "perc_in")
|
Some larger datasets need to be installed separately, like senators and
house_district_forecast. To install these, we recommend you install the
fivethirtyeightdata package by running:
install.packages('fivethirtyeightdata', repos =
'https://fivethirtyeightdata.github.io/drat/', type = 'source')
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.