Rows: 62 Columns: 4
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (2): Area Name, Population Percent Change
num (2): 2020 Census Population, Population Change
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 4029 Columns: 14
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (9): Record Create Date, Patrol Borough Name, County, Law Code Category ...
dbl (4): Full Complaint ID, Complaint Year Number, Month Number, Complaint P...
lgl (1): Arrest Date
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Clean Up the Data
names(hatecrimes) <-tolower(names(hatecrimes))names(hatecrimes) <-gsub(" ","",names(hatecrimes)) #gsub turns "<space>" to <> for the variable row "names"head(hatecrimes)
bias_count <- hatecrimes |>select(biasmotivedescription) |>#selecting the columngroup_by(biasmotivedescription) |>#making bias the variable of interestcount() |>arrange(desc(n)) #sorts the counts by highest to lowesthead(bias_count) #gives us the 6 row summary
bias_count |>head(10) |>ggplot(aes(x=biasmotivedescription, y = n)) +geom_col()
Arrange by Height & Rotate
bias_count |>head(10) |>ggplot(aes(x=reorder(biasmotivedescription, n), y = n)) +geom_col() +coord_flip()
Cosmetic Edits: Title, Captions, Color, etc.
bias_count |>#calls datahead(10) |>#excludes non top 10ggplot(aes(x=reorder(biasmotivedescription, n),y=n)) +#flips graphgeom_col(fill ="blue") +#fills bar with bluecoord_flip()+#arranges text below to appear flippedlabs(x ="",y ="Counts of Hate Crime Types By Motive",title ="Bar Graph of Hate Crimes from 2019-2026",subtitle ="Counts based on the hatecrime motive",caption ="Source: NY State Division of Criminal Justice Services")
# A tibble: 127 × 4
# Groups: complaintyearnumber, county [35]
complaintyearnumber county biasmotivedescription n
<dbl> <chr> <chr> <int>
1 2024 KINGS ANTI-JEWISH 152
2 2024 NEW YORK ANTI-JEWISH 136
3 2025 KINGS ANTI-JEWISH 136
4 2019 KINGS ANTI-JEWISH 128
5 2023 KINGS ANTI-JEWISH 126
6 2022 KINGS ANTI-JEWISH 125
7 2023 NEW YORK ANTI-JEWISH 124
8 2025 NEW YORK ANTI-JEWISH 110
9 2022 NEW YORK ANTI-JEWISH 104
10 2021 NEW YORK ANTI-ASIAN 84
# ℹ 117 more rows
Select Group Crimes Plotted Together
#dodge puts the graphs next to one another by year since our grouping is done by the variable "complaintyearnumber"ggplot(data = hate2)+geom_bar(aes(x=complaintyearnumber, y=n, fill = biasmotivedescription),position ="dodge", stat ="identity") +labs(fill ="Hate Crime Type",y ="Number of Hate Crime Incidents",title ="Hate Crime Type in NY Counties Between 2010-16",caption ="Source: NY State Division of Criminal Justice Services")
Select Group Hate Crime Count by County
ggplot(data = hate2)+geom_bar(aes(x=county, y=n, fill = biasmotivedescription),position ="dodge", stat ="identity") +labs(fill ="Hate Crime Type",y ="Number of Hate Crime Incidents",title ="Hate Crime Type in NY Counties Between 2010-16",caption ="Source: NY State Division of Criminal Justice Services")
County Segregated Visualization
ggplot(data = hate2) +geom_bar(aes(x=complaintyearnumber, y=n, fill=biasmotivedescription),position="dodge", stat ="identity") +facet_wrap(~county) +#Splits data by countylabs(fill ="Hate Crime Type",y ="Number of Hate Crime Incidents",title ="Hate Crime Type in NY Counties Between 2010-2016",caption ="Source: NY State Division of Criminal Justice Services")
# A tibble: 127 × 5
# Groups: complaintyearnumber, county [35]
complaintyearnumber county biasmotivedescription n 2020 Census Populati…¹
<dbl> <chr> <chr> <int> <dbl>
1 2024 KINGS ANTI-JEWISH 152 NA
2 2024 NEW Y… ANTI-JEWISH 136 NA
3 2025 KINGS ANTI-JEWISH 136 NA
4 2019 KINGS ANTI-JEWISH 128 NA
5 2023 KINGS ANTI-JEWISH 126 NA
6 2022 KINGS ANTI-JEWISH 125 NA
7 2023 NEW Y… ANTI-JEWISH 124 NA
8 2025 NEW Y… ANTI-JEWISH 110 NA
9 2022 NEW Y… ANTI-JEWISH 104 NA
10 2021 NEW Y… ANTI-ASIAN 84 NA
# ℹ 117 more rows
# ℹ abbreviated name: ¹`2020 Census Population`
# A tibble: 6 × 4
# Groups: complaintyearnumber, county [6]
complaintyearnumber county biasmotivedescription n
<dbl> <fct> <chr> <int>
1 2024 kings ANTI-JEWISH 152
2 2024 new york ANTI-JEWISH 136
3 2025 kings ANTI-JEWISH 136
4 2019 kings ANTI-JEWISH 128
5 2023 kings ANTI-JEWISH 126
6 2022 kings ANTI-JEWISH 125
datajoinrate <- datajoin |>mutate(rate = n/`2020 Census Population`*100000) |>arrange(desc(rate))datajoinrate
# A tibble: 127 × 6
# Groups: complaintyearnumber, county [35]
complaintyearnumber county biasmotivedescription n 2020 Census Populati…¹
<dbl> <chr> <chr> <int> <dbl>
1 2024 KINGS ANTI-JEWISH 152 NA
2 2024 NEW Y… ANTI-JEWISH 136 NA
3 2025 KINGS ANTI-JEWISH 136 NA
4 2019 KINGS ANTI-JEWISH 128 NA
5 2023 KINGS ANTI-JEWISH 126 NA
6 2022 KINGS ANTI-JEWISH 125 NA
7 2023 NEW Y… ANTI-JEWISH 124 NA
8 2025 NEW Y… ANTI-JEWISH 110 NA
9 2022 NEW Y… ANTI-JEWISH 104 NA
10 2021 NEW Y… ANTI-ASIAN 84 NA
# ℹ 117 more rows
# ℹ abbreviated name: ¹`2020 Census Population`
# ℹ 1 more variable: rate <dbl>
Questions
Write about the positive and negative aspects of this hatecrimes dataset.
The dataset is useful because it provides raw data that is incredibly detailed and specific. It includes information about the year, county, type of offense, and bias motive, which makes it possible to look at hate crimes from several different angles. I also like that the data can be grouped by both time and location, allowing patterns to be compared between different counties and years. However, there are some important limitations. The tutorial asks for data between “2010-2016,” while the actual dataset includes entries from 2019-2026. The dataset would be improved if it actually spanned 2010-2026, since having a longer timeframe could make it easier to identify long-term patterns instead of only more recent ones. Another major issue is that hate crimes can go unreported or unrecorded. The tutorial itself points out that the FBI relies on local law enforcement agencies to collect and submit hate crime data, meaning the dataset may not include every hate crime that actually occurred. Because of this, the numbers should not necessarily be treated as a complete representation of hate crimes in New York. Overall, the dataset is detailed and useful, but its limitations should be considered when interpreting the results.
List 2 different paths you could hypothetically like to study about this dataset at some future point.
One path I would be interested in studying is whether individual hate crimes can have multiple bias motives at the same time. For example, I would want to see if a crime could be classified as both anti-Asian and anti-male homosexual. It would be interesting to see which combinations of bias motives occur most often and whether certain combinations are more common in specific counties or years. This could show patterns that would not be visible if every bias motive was studied separately.
A second path I would like to study is the rate of hate crimes compared to the population of the group being targeted. The current analysis mostly looks at the number of incidents, but a county with a larger population would naturally have more opportunities for incidents to occur. I would want to use demographic population data to calculate rates for specific groups, such as anti-Asian hate crimes compared to the Asian population or anti-Black hate crimes compared to the Black population. This would make it possible to compare counties more proportionally instead of only comparing their total number of incidents. It could also reveal patterns that are hidden when only looking at raw counts.