Code
CRIMERECENT <- read.csv("CRIMERECENT.csv")
library(plotly)
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages({
library(knitr)
library(kableExtra)
})NYPD’s Bureau of Youth Strategies Division
Dedicated to providing support and programs for young people at risk of being influenced by crime. They seek to improve relationships between police and the community while offering a place for young people to mature unaffected by gangs or crime in their respective neighborhood.
https://www.nyc.gov/site/nypd/bureaus/administrative/youth-services.page
After careful consideration of the data presented, it is recommended that the NYPD’s Bureau of Youth Strategies Division increase its ‘after school’ youth programs to combat a surge of juvenile crime affecting the 40th, 44st, 73rd and 75th precincts after school hours. Furthermore, these programs should provide a method of transportation across New York City, to decrease the likelihood of crime happening on the unsupervised and dangerous streets of the city.
CRIMERECENT <- read.csv("CRIMERECENT.csv")
library(plotly)
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages({
library(knitr)
library(kableExtra)
})library(dplyr)
library(ggplot2)
library(plotly)
juvenile_precincts <- CRIMERECENT %>%
filter(VIC_AGE_GROUP == "<18") %>%
filter(!is.na(ADDR_PCT_CD)) %>%
group_by(ADDR_PCT_CD) %>%
summarise(juvenile_complaints = n())
threshold <- quantile(juvenile_precincts$juvenile_complaints, 0.95)
juvenile_precincts <- juvenile_precincts %>%
mutate(danger_zone = factor(
juvenile_complaints >= threshold,
levels = c(FALSE, TRUE),
labels = c("Other Precincts", "Danger Zone (Top 5%)")
))
p <- ggplot(juvenile_precincts, aes(x = ADDR_PCT_CD, y = juvenile_complaints,
text = paste("Precinct:", ADDR_PCT_CD,
"<br>Complaints:", juvenile_complaints))) +
geom_point(aes(color = danger_zone), shape = 4, size = 2, stroke = .5) +
geom_hline(yintercept = threshold, linetype = "dashed", color = "red") +
scale_color_manual(values = c("blue", "red")) +
scale_x_continuous(
breaks = seq(0, max(juvenile_precincts$ADDR_PCT_CD, na.rm = TRUE), by = 5),
limits = c(0, max(juvenile_precincts$ADDR_PCT_CD, na.rm = TRUE) + 5),
expand = c(0, 0)
) +
labs(
title = "Juvenile Crime Complaints by NYPD Precinct with 'Danger Zones'",
x = "Precinct Number",
y = "Number of Juvenile Crime Complaints",
color = NULL
) +
theme_minimal(base_size = 11) +
theme(
legend.position = "top",
legend.title = element_blank(),
legend.text = element_text(size = 12, face = "bold"),
plot.title = element_text(hjust = .05, size = 12, face = "bold"),
axis.text.x = element_text(angle = 45, hjust = 1)
)
ggplotly(p, tooltip = "text")This scatter plot shows that there are four NYPD precincts in the top 5% of Juvenile Crime Complaints, these being precincts 40, 44, 73 & 75. They make up ~11.86% of all juvenile crime committed in the data set. Precincts 40 and 44 are geographically adjacent (The Bronx) to each other, as are precincts 73 and 75 (North East Brookyln). Indicating that these precincts are the areas in New York City most affected most by juvenile crime.
library(kableExtra)
library(knitr)
poverty_da <- read.csv("NEWP.csv")
kable(poverty_da[1:8, ], format = "html") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"), full_width = FALSE) %>%
row_spec(2, background = "#FFF3CD") %>%
row_spec(8, background = "#FFF3CD")| Borough | Neighborhood | X5.Year.Avg.Poverty.Rate | Margin.of.Error |
|---|---|---|---|
| Bronx | Morris Heights, Fordham South, and Mount Hope | 35.4 | +/-2.2 |
| Bronx | Concourse, Highbridge, and Mount Eden | 33.6 | +/-2.2 |
| Bronx | Hunts Point, Longwood, and Melrose | 31.5 | +/-2.2 |
| Bronx | Belmont, Crotona Park East, and East Tremont | 30.9 | +/-2.0 |
| Bronx | Castle Hill, Clason Point, and Parkchester | 29.0 | +/-1.8 |
| Bronx | Bedford Park, Fordham North, and Norwood | 28.7 | +/-2.0 |
| Brooklyn | Brownsville and Ocean Hill | 28.5 | +/-2.1 |
| Brooklyn | East New York and Starrett City | 27.7 | +/-2.0 |
Highlighted from the NYC Poverty Index (2015-2019) we can see that precincts 40/44 have ~1/3 of the population living in poverty while precincts 73/75 have a little over 1/4 of the population living in poverty. For reference, in 2019 10.5% of the American population was living in poverty (U.S Bureau of Labor Statistics), meaning that the four precincts are on average 2.919x above the national poverty rate.
10/10 precincts with the most juvenile crime complaints are located in the top 8 poorest neighborhoods, as shown from the data provided by the NYC Poverty index. This indicates that a reason for the spike in juvenile crime in these areas is due to the conditions that the youth are living in, being that of poverty and limited opportunity.
library(dplyr)
library(ggplot2)
# Ensure precinct column is numeric
CRIMERECENT <- CRIMERECENT %>%
mutate(ADDR_PCT_CD = as.numeric(ADDR_PCT_CD))
# Define target precincts
target_precincts <- c(40, 44, 73, 75)
# Process youth crimes and extract hour
youth_crimes_hourly <- CRIMERECENT %>%
filter(
VIC_AGE_GROUP == "<18",
ADDR_PCT_CD %in% target_precincts,
!is.na(CMPLNT_FR_TM)
) %>%
mutate(
hour = suppressWarnings(as.numeric(substr(CMPLNT_FR_TM, 1, 2)))
) %>%
filter(!is.na(hour), hour >= 0, hour <= 23) %>%
group_by(hour) %>%
summarise(youth_crime_count = n()) %>%
ungroup()
# Plot
ggplot(youth_crimes_hourly, aes(x = hour, y = youth_crime_count)) +
annotate("rect", xmin = 15, xmax = 18, ymin = 0, ymax = Inf, alpha = 0.2, fill = "red") +
geom_line(color = "blue", linewidth = 1) +
geom_point(color = "black", size = 2) +
scale_x_continuous(breaks = 0:23) +
labs(
title = "Youth Crimes by Time of Day (with After-School Highlight)",
x = "Hour of Day",
y = "Youth Crime Count"
) +
theme_minimal()This graph shows the trend between juvenile crime and time of the day. As shown on the graph, crime rates peak at 15:00 and remain elevated until after 18:00. The NYC Parks Department (2019) lists after-school hours from 15:45-18:00, meaning that this period of an elevated crime rate coincides with the dismissal of children from schooling institutions. In order to curb youth crime rates, an emphasis should be made to addressing crime during this period of the day.
library(dplyr)
library(ggplot2)
# Step 1: Clean CRIMERECENT once with hour column
CRIMERECENT <- CRIMERECENT %>%
mutate(
hour = suppressWarnings(as.numeric(substr(CMPLNT_FR_TM, 1, 2)))
)
# Step 2: Define precincts and after-school hour range
target_precincts <- c(40, 44, 73, 75)
after_school_hours <- 15:18
# Step 3: Filter and count crimes
after_school_crimes <- CRIMERECENT %>%
filter(
VIC_AGE_GROUP == "<18",
ADDR_PCT_CD %in% target_precincts,
!is.na(CMPLNT_FR_TM),
!is.na(PREM_TYP_DESC),
hour %in% after_school_hours
)
premise_counts <- after_school_crimes %>%
group_by(PREM_TYP_DESC) %>%
summarise(count = n()) %>%
arrange(desc(count)) %>%
slice_head(n = 15)
# Step 4: Plot
ggplot(premise_counts, aes(x = reorder(PREM_TYP_DESC, count), y = count)) +
geom_bar(stat = "identity", fill = "blue") +
coord_flip() +
labs(
title = "Top Premises for Youth Crime (15:45–18:00)",
x = "Premise Type",
y = "Crime Count"
) +
theme_minimal()As seen by the bar graph, the majority of youth crime during ‘after school hours’ occurs on the street. This is due to a variety of factors that include but are not limited to; lack of structured after-school programs, increased peer interaction without oversight, and the accessibility of streets as common gathering points for adolescents.
Professionalism All data collected for this report was only from official government sources.
Exposing and Reviewing Methods and Findings Data was only used if it could be accessible to anyone reading the report. Everything in this report can be openly accessed by the public.
ChatGPT - 4o 15/6/25 https://chatgpt.com/share/6825d0a1-72f0-8010-8079-98dd201635dc Helped me make my first graph interactive in the (Evidence) section
ChatGPT - 4o 15/6/25 https://chatgpt.com/share/6825d15f-f4c8-8010-8f44-3582770e246f Suggested how to highlight rows of my table for the NYC neighbourhood poverty index
ChatGPT - 4o 15/6/25 https://chatgpt.com/share/6825d241-e4cc-8010-a9d8-1d21e17f11f7 Suggessted how to remove error packages in my render
External Evidence: