The number of individuals who entered as emerging adults and have been incarcerated for at least 20 years (broken down by ‘years served’ cohorts)
library(dplyr)library(tidyverse)Iowa_Pop$Years.Served <- Iowa_Pop$Months.Served /12LPT <- Iowa_Pop %>%filter(Years.Served >=20)LPT <- LPT %>%mutate(Admission.Date =as.Date(Prison.Start.Date, format ="%m/%d/%Y"),Admission.Year =year(Admission.Date))current_year <-as.numeric(format(Sys.Date(), "%Y"))LPT <- LPT %>%mutate(Birth.Year = current_year - Age)LPT <- LPT %>%mutate(Age.At.Admission = Admission.Year - Birth.Year)LPT<- LPT %>%mutate(Age.Group =ifelse(Age >=55, "55 and older", "55 and Young"),Race.Category =ifelse(Race...Ethnicity %in%c("Black", "Hispanic", "American Indian or Alaska Native", "Asian or Pacific Islander"), "People of Color", "White"))under_25_at_admission <- LPT %>%filter(Age.At.Admission <25)count_under_25 <- under_25_at_admission %>%summarise(Total.Count =n())under_25_at_admission <- under_25_at_admission %>%mutate(Years.Served.Group =cut(Years.Served, breaks =seq(20, max(Years.Served, na.rm =TRUE) +5, by =5), right =FALSE, include.lowest =TRUE))years_served_breakdown <- under_25_at_admission %>%group_by(Years.Served.Group) %>%summarise(Total.Count =n())datatable(years_served_breakdown,caption ="The number of individuals who entered as emerging adults and have been incarcerated for at least 20 years (broken down by years served cohorts")
Average Time served by offense, age-group, and race category
`summarise()` has grouped output by 'Age.Group', 'Race.Category',
'Offense.Description'. You can override using the `.groups` argument.
print(Offense_LOS)
# A tibble: 75 × 6
Age.Group Race.Category Offense.Description Offense.Type Average.Years.Served
<chr> <chr> <chr> <chr> <dbl>
1 55 and Y… People of Co… BURGLARY 1ST DEGREE Violent 21.1
2 55 and Y… People of Co… KIDNAPPING - 2ND D… Violent 24.8
3 55 and Y… People of Co… KIDNAPPING 1ST DEG… Violent 24.1
4 55 and Y… People of Co… MURDER 1ST DEGREE Violent 26.0
5 55 and Y… People of Co… MURDER 2ND - 85% Violent 21.3
6 55 and Y… People of Co… ROBBERY 1ST DEGREE Violent 28.8
7 55 and Y… People of Co… ROBBERY 2ND DEGREE… Violent 21.5
8 55 and Y… People of Co… SEXUAL ABUSE - 2ND… Violent 23.1
9 55 and Y… White ATTEMPT TO COMMIT … Violent 30.9
10 55 and Y… White ATTEMPTED MURDER, … Violent 23.6
# ℹ 65 more rows
# ℹ 1 more variable: Count <int>
ggplot(Offense_LOS, aes(x = Offense.Type, y = Average.Years.Served, fill =interaction(Age.Group, Race.Category) ))+geom_bar(stat ="identity", position ="dodge") +labs(title ="Average Time Served by Offense Type, Age Group, and Race Category",x ="Offense Type",y ="Average Years Served") +theme_minimal() +scale_fill_manual(values =c("55 and older.People of Color"="blue", "55 and Young.People of Color"="lightblue", "55 and older.White"="red", "55 and Young.White"="pink")) +theme(axis.text.x =element_text(angle =45, hjust =1))
Average Years Served for People Incarcerated Before/After 25, Now Over 55’ by admission cohort
`summarise()` has grouped output by 'Age.Cohort'. You can override using the
`.groups` argument.
LPT_age_race_distribution <- LPT_total_age_race %>%left_join(LPT_violent_age_race, by =c("Age.Cohort", "Race.Category")) %>%mutate(Proportion.Violent = Violent.Count / Total.Count)datatable(LPT_age_race_distribution, caption ='Proportion of Individuals Serving Long Prison Terms for Violent Offenses by Age Cohort and Race/Ethnicity')