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

Create hackForCA_prisons.Rmd #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
49 changes: 49 additions & 0 deletions proximity-app/explore-data/hackForCA_prisons.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: "HackforCA:Toxic Prisons"
author: "Deckard Barnes"
date: "10/25/2020"
output: html_document
---

```{r}
library(tidyr)
library(dplyr)
library(ggplot2)
```

Load the prison boundaries dataset

```{r}
prisons <-read.csv("/Users/Decka/Downloads/Prison_Boundaries.csv")
```

```{r}
head(prisons) #quick overview of the dataset
glimpse(prisons)
```

Many missing values for prison Populations in this dataset
```{r}
#Missing values in this dataset are coded as -999
prisons %>%
select(STATE, POPULATION)

#Finding the total prison population
prisons %>%
filter(POPULATION != -999) %>%
summarize(total_pop = sum(POPULATION))
```



Count the number of missing values for population per state
```{r}
prisons %>%
#filter for rows containing null values(-999)
filter(POPULATION == -999) %>%
#group by state
group_by(STATE) %>%
#count the number of missing values in each state and sort(desc)
count(sort = TRUE)
```