library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(tinytex)
setwd("C:/Users/ava/Downloads/data110")
hatecrimes2010 <- read_csv("hatecrimes2010.csv")
## Rows: 423 Columns: 44
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): County, Crime Type
## dbl (42): Year, Anti-Male, Anti-Female, Anti-Transgender, Anti-Gender Identi...
##
## ℹ 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.
names(hatecrimes2010) <- tolower(names(hatecrimes2010))
names(hatecrimes2010) <- gsub(" ","",names(hatecrimes2010))
head(hatecrimes2010)
## # A tibble: 6 × 44
## county year crimetype `anti-male` `anti-female` `anti-transgender`
## <chr> <dbl> <chr> <dbl> <dbl> <dbl>
## 1 Albany 2016 Crimes Against Pe… 0 0 0
## 2 Albany 2016 Property Crimes 0 0 0
## 3 Allegany 2016 Property Crimes 0 0 0
## 4 Bronx 2016 Crimes Against Pe… 0 0 4
## 5 Bronx 2016 Property Crimes 0 0 0
## 6 Broome 2016 Crimes Against Pe… 0 0 0
## # ℹ 38 more variables: `anti-genderidentityexpression` <dbl>,
## # `anti-age*` <dbl>, `anti-white` <dbl>, `anti-black` <dbl>,
## # `anti-americanindian/alaskannative` <dbl>, `anti-asian` <dbl>,
## # `anti-nativehawaiian/pacificislander` <dbl>,
## # `anti-multi-racialgroups` <dbl>, `anti-otherrace` <dbl>,
## # `anti-jewish` <dbl>, `anti-catholic` <dbl>, `anti-protestant` <dbl>,
## # `anti-islamic(muslim)` <dbl>, `anti-multi-religiousgroups` <dbl>, …
summary(hatecrimes2010)
## county year crimetype anti-male
## Length:423 Min. :2010 Length:423 Min. :0.000000
## Class :character 1st Qu.:2011 Class :character 1st Qu.:0.000000
## Mode :character Median :2013 Mode :character Median :0.000000
## Mean :2013 Mean :0.007092
## 3rd Qu.:2015 3rd Qu.:0.000000
## Max. :2016 Max. :1.000000
## anti-female anti-transgender anti-genderidentityexpression
## Min. :0.00000 Min. :0.00000 Min. :0.00000
## 1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.00000
## Median :0.00000 Median :0.00000 Median :0.00000
## Mean :0.01655 Mean :0.04728 Mean :0.05674
## 3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.00000
## Max. :1.00000 Max. :5.00000 Max. :3.00000
## anti-age* anti-white anti-black
## Min. :0.00000 Min. : 0.0000 Min. : 0.000
## 1st Qu.:0.00000 1st Qu.: 0.0000 1st Qu.: 0.000
## Median :0.00000 Median : 0.0000 Median : 1.000
## Mean :0.05201 Mean : 0.3357 Mean : 1.761
## 3rd Qu.:0.00000 3rd Qu.: 0.0000 3rd Qu.: 2.000
## Max. :9.00000 Max. :11.0000 Max. :18.000
## anti-americanindian/alaskannative anti-asian
## Min. :0.000000 Min. :0.0000
## 1st Qu.:0.000000 1st Qu.:0.0000
## Median :0.000000 Median :0.0000
## Mean :0.007092 Mean :0.1773
## 3rd Qu.:0.000000 3rd Qu.:0.0000
## Max. :1.000000 Max. :8.0000
## anti-nativehawaiian/pacificislander anti-multi-racialgroups anti-otherrace
## Min. :0 Min. :0.00000 Min. :0
## 1st Qu.:0 1st Qu.:0.00000 1st Qu.:0
## Median :0 Median :0.00000 Median :0
## Mean :0 Mean :0.08511 Mean :0
## 3rd Qu.:0 3rd Qu.:0.00000 3rd Qu.:0
## Max. :0 Max. :3.00000 Max. :0
## anti-jewish anti-catholic anti-protestant anti-islamic(muslim)
## Min. : 0.000 Min. : 0.0000 Min. :0.00000 Min. : 0.0000
## 1st Qu.: 0.000 1st Qu.: 0.0000 1st Qu.:0.00000 1st Qu.: 0.0000
## Median : 0.000 Median : 0.0000 Median :0.00000 Median : 0.0000
## Mean : 3.981 Mean : 0.2695 Mean :0.02364 Mean : 0.4704
## 3rd Qu.: 3.000 3rd Qu.: 0.0000 3rd Qu.:0.00000 3rd Qu.: 0.0000
## Max. :82.000 Max. :12.0000 Max. :1.00000 Max. :10.0000
## anti-multi-religiousgroups anti-atheism/agnosticism
## Min. : 0.00000 Min. :0
## 1st Qu.: 0.00000 1st Qu.:0
## Median : 0.00000 Median :0
## Mean : 0.07565 Mean :0
## 3rd Qu.: 0.00000 3rd Qu.:0
## Max. :10.00000 Max. :0
## anti-religiouspracticegenerally anti-otherreligion anti-buddhist
## Min. :0.000000 Min. :0.000 Min. :0
## 1st Qu.:0.000000 1st Qu.:0.000 1st Qu.:0
## Median :0.000000 Median :0.000 Median :0
## Mean :0.007092 Mean :0.104 Mean :0
## 3rd Qu.:0.000000 3rd Qu.:0.000 3rd Qu.:0
## Max. :2.000000 Max. :4.000 Max. :0
## anti-easternorthodox(greek,russian,etc.) anti-hindu
## Min. :0.000000 Min. :0.000000
## 1st Qu.:0.000000 1st Qu.:0.000000
## Median :0.000000 Median :0.000000
## Mean :0.002364 Mean :0.002364
## 3rd Qu.:0.000000 3rd Qu.:0.000000
## Max. :1.000000 Max. :1.000000
## anti-jehovahswitness anti-mormon anti-otherchristian anti-sikh
## Min. :0 Min. :0 Min. :0.00000 Min. :0
## 1st Qu.:0 1st Qu.:0 1st Qu.:0.00000 1st Qu.:0
## Median :0 Median :0 Median :0.00000 Median :0
## Mean :0 Mean :0 Mean :0.01655 Mean :0
## 3rd Qu.:0 3rd Qu.:0 3rd Qu.:0.00000 3rd Qu.:0
## Max. :0 Max. :0 Max. :3.00000 Max. :0
## anti-hispanic anti-arab anti-otherethnicity/nationalorigin
## Min. : 0.0000 Min. :0.00000 Min. : 0.0000
## 1st Qu.: 0.0000 1st Qu.:0.00000 1st Qu.: 0.0000
## Median : 0.0000 Median :0.00000 Median : 0.0000
## Mean : 0.3735 Mean :0.06619 Mean : 0.2837
## 3rd Qu.: 0.0000 3rd Qu.:0.00000 3rd Qu.: 0.0000
## Max. :17.0000 Max. :2.00000 Max. :19.0000
## anti-non-hispanic* anti-gaymale anti-gayfemale anti-gay(maleandfemale)
## Min. :0 Min. : 0.000 Min. :0.0000 Min. :0.0000
## 1st Qu.:0 1st Qu.: 0.000 1st Qu.:0.0000 1st Qu.:0.0000
## Median :0 Median : 0.000 Median :0.0000 Median :0.0000
## Mean :0 Mean : 1.499 Mean :0.2411 Mean :0.1017
## 3rd Qu.:0 3rd Qu.: 1.000 3rd Qu.:0.0000 3rd Qu.:0.0000
## Max. :0 Max. :36.000 Max. :8.0000 Max. :4.0000
## anti-heterosexual anti-bisexual anti-physicaldisability
## Min. :0.000000 Min. :0.000000 Min. :0.00000
## 1st Qu.:0.000000 1st Qu.:0.000000 1st Qu.:0.00000
## Median :0.000000 Median :0.000000 Median :0.00000
## Mean :0.002364 Mean :0.004728 Mean :0.01182
## 3rd Qu.:0.000000 3rd Qu.:0.000000 3rd Qu.:0.00000
## Max. :1.000000 Max. :1.000000 Max. :1.00000
## anti-mentaldisability totalincidents totalvictims totaloffenders
## Min. :0.000000 Min. : 1.00 Min. : 1.00 Min. : 1.00
## 1st Qu.:0.000000 1st Qu.: 1.00 1st Qu.: 1.00 1st Qu.: 1.00
## Median :0.000000 Median : 3.00 Median : 3.00 Median : 3.00
## Mean :0.009456 Mean : 10.09 Mean : 10.48 Mean : 11.77
## 3rd Qu.:0.000000 3rd Qu.: 10.00 3rd Qu.: 10.00 3rd Qu.: 11.00
## Max. :1.000000 Max. :101.00 Max. :106.00 Max. :113.00
hatecrimes2 <- hatecrimes2010 |>
select(county, year, 'anti-transgender', 'anti-white', 'anti-jewish', 'anti-catholic','anti-age*','anti-islamic(muslim)', `anti-multi-religiousgroups`, 'anti-gaymale', 'anti-hispanic', `anti-otherethnicity/nationalorigin`) |>
group_by(county, year)
head(hatecrimes2)
## # A tibble: 6 × 12
## # Groups: county, year [4]
## county year `anti-transgender` `anti-white` `anti-jewish` `anti-catholic`
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Albany 2016 0 0 0 0
## 2 Albany 2016 0 0 0 0
## 3 Allegany 2016 0 0 0 0
## 4 Bronx 2016 4 1 0 0
## 5 Bronx 2016 0 1 1 0
## 6 Broome 2016 0 0 0 0
## # ℹ 6 more variables: `anti-age*` <dbl>, `anti-islamic(muslim)` <dbl>,
## # `anti-multi-religiousgroups` <dbl>, `anti-gaymale` <dbl>,
## # `anti-hispanic` <dbl>, `anti-otherethnicity/nationalorigin` <dbl>
dim(hatecrimes2)
## [1] 423 12
# There are currently 12 variables with 423 rows.
summary(hatecrimes2)
## county year anti-transgender anti-white
## Length:423 Min. :2010 Min. :0.00000 Min. : 0.0000
## Class :character 1st Qu.:2011 1st Qu.:0.00000 1st Qu.: 0.0000
## Mode :character Median :2013 Median :0.00000 Median : 0.0000
## Mean :2013 Mean :0.04728 Mean : 0.3357
## 3rd Qu.:2015 3rd Qu.:0.00000 3rd Qu.: 0.0000
## Max. :2016 Max. :5.00000 Max. :11.0000
## anti-jewish anti-catholic anti-age* anti-islamic(muslim)
## Min. : 0.000 Min. : 0.0000 Min. :0.00000 Min. : 0.0000
## 1st Qu.: 0.000 1st Qu.: 0.0000 1st Qu.:0.00000 1st Qu.: 0.0000
## Median : 0.000 Median : 0.0000 Median :0.00000 Median : 0.0000
## Mean : 3.981 Mean : 0.2695 Mean :0.05201 Mean : 0.4704
## 3rd Qu.: 3.000 3rd Qu.: 0.0000 3rd Qu.:0.00000 3rd Qu.: 0.0000
## Max. :82.000 Max. :12.0000 Max. :9.00000 Max. :10.0000
## anti-multi-religiousgroups anti-gaymale anti-hispanic
## Min. : 0.00000 Min. : 0.000 Min. : 0.0000
## 1st Qu.: 0.00000 1st Qu.: 0.000 1st Qu.: 0.0000
## Median : 0.00000 Median : 0.000 Median : 0.0000
## Mean : 0.07565 Mean : 1.499 Mean : 0.3735
## 3rd Qu.: 0.00000 3rd Qu.: 1.000 3rd Qu.: 0.0000
## Max. :10.00000 Max. :36.000 Max. :17.0000
## anti-otherethnicity/nationalorigin
## Min. : 0.0000
## 1st Qu.: 0.0000
## Median : 0.0000
## Mean : 0.2837
## 3rd Qu.: 0.0000
## Max. :19.0000
hatelong <- hatecrimes2 |>
pivot_longer(
cols = 3:12,
names_to = "victim_cat",
values_to = "crimecount")
hatecrimplot <-hatelong |>
ggplot(aes(year, crimecount))+
geom_point()+
aes(color = victim_cat)+
facet_wrap(~victim_cat)
hatecrimplot
hatenew <- hatelong |>
filter( victim_cat %in% c("anti-black", "anti-jewish", "anti-gaymale"))|>
group_by(year, county) |>
arrange(desc(crimecount))
hatenew
## # A tibble: 846 × 4
## # Groups: year, county [277]
## county year victim_cat crimecount
## <chr> <dbl> <chr> <dbl>
## 1 Kings 2012 anti-jewish 82
## 2 Kings 2016 anti-jewish 51
## 3 Suffolk 2014 anti-jewish 48
## 4 Suffolk 2012 anti-jewish 48
## 5 Kings 2011 anti-jewish 44
## 6 Kings 2013 anti-jewish 41
## 7 Kings 2010 anti-jewish 39
## 8 Nassau 2011 anti-jewish 38
## 9 Suffolk 2013 anti-jewish 37
## 10 Nassau 2016 anti-jewish 36
## # ℹ 836 more rows
plot2 <- hatenew |>
ggplot() +
geom_bar(aes(x=year, y=crimecount, fill = victim_cat),
position = "dodge", stat = "identity") +
labs(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")
plot2
counties <- hatenew |>
group_by(year, county)|>
summarize(sum = sum(crimecount)) |>
arrange(desc(sum))
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
counties
## # A tibble: 277 × 3
## # Groups: year [7]
## year county sum
## <dbl> <chr> <dbl>
## 1 2012 Kings 126
## 2 2016 Kings 95
## 3 2010 Kings 94
## 4 2013 Kings 90
## 5 2014 Kings 90
## 6 2015 Kings 82
## 7 2016 New York 79
## 8 2011 Kings 78
## 9 2013 New York 67
## 10 2015 New York 63
## # ℹ 267 more rows
plot3 <- hatenew |>
ggplot() +
geom_bar(aes(x=county, y=crimecount, fill = victim_cat),
position = "dodge", stat = "identity") +
labs(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")
plot3
counties2 <- hatenew |>
group_by(county)|>
summarize(sum = sum(crimecount)) |>
slice_max(order_by = sum, n=5)
counties2
## # A tibble: 5 × 2
## county sum
## <chr> <dbl>
## 1 Kings 655
## 2 New York 405
## 3 Suffolk 264
## 4 Nassau 227
## 5 Queens 205
plot4 <- hatenew |>
filter(county %in% c("Kings", "New York", "Suffolk", "Nassau", "Queens")) |>
ggplot() +
geom_bar(aes(x=county, y=crimecount, fill = victim_cat),
position = "dodge", stat = "identity") +
labs(y = "Number of Hate Crime Incidents",
title = "5 Counties in NY with Highest Incidents of Hate Crimes",
subtitle = "Between 2010-2016",
fill = "Hate Crime Type",
caption = "Source: NY State Division of Criminal Justice Services")
plot4
setwd("C:/Users/ava/Downloads/data110")
nypop <- read_csv("newyorkpopulation.csv")
## Rows: 62 Columns: 8
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): Geography
## dbl (7): 2010, 2011, 2012, 2013, 2014, 2015, 2016
##
## ℹ 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.
nypop$Geography <- gsub(" , New York", "", nypop$Geography)
nypop$Geography <- gsub("County", "", nypop$Geography)
nypoplong <- nypop |>
rename(county = Geography) |>
gather("year", "population", 2:8)
nypoplong$year <- as.double(nypoplong$year)
head(nypoplong)
## # A tibble: 6 × 3
## county year population
## <chr> <dbl> <dbl>
## 1 Albany , New York 2010 304078
## 2 Allegany , New York 2010 48949
## 3 Bronx , New York 2010 1388240
## 4 Broome , New York 2010 200469
## 5 Cattaraugus , New York 2010 80249
## 6 Cayuga , New York 2010 79844
nypoplong12 <- nypoplong |>
filter(year == 2012) |>
arrange(desc(population)) |>
head(10)
nypoplong12$county<-gsub(" , New York","",nypoplong12$county)
nypoplong12
## # A tibble: 10 × 3
## county year population
## <chr> <dbl> <dbl>
## 1 Kings 2012 2572282
## 2 Queens 2012 2278024
## 3 New York 2012 1625121
## 4 Suffolk 2012 1499382
## 5 Bronx 2012 1414774
## 6 Nassau 2012 1350748
## 7 Westchester 2012 961073
## 8 Erie 2012 920792
## 9 Monroe 2012 748947
## 10 Richmond 2012 470978
counties12 <- counties |>
filter(year == 2012) |>
arrange(desc(sum))
counties12
## # A tibble: 41 × 3
## # Groups: year [1]
## year county sum
## <dbl> <chr> <dbl>
## 1 2012 Kings 126
## 2 2012 New York 61
## 3 2012 Suffolk 57
## 4 2012 Queens 46
## 5 2012 Nassau 33
## 6 2012 Bronx 15
## 7 2012 Richmond 15
## 8 2012 Westchester 10
## 9 2012 Erie 9
## 10 2012 Multiple 6
## # ℹ 31 more rows
datajoin <- counties12 |>
full_join(nypoplong12, by=c("county", "year"))
datajoin
## # A tibble: 41 × 4
## # Groups: year [1]
## year county sum population
## <dbl> <chr> <dbl> <dbl>
## 1 2012 Kings 126 2572282
## 2 2012 New York 61 1625121
## 3 2012 Suffolk 57 1499382
## 4 2012 Queens 46 2278024
## 5 2012 Nassau 33 1350748
## 6 2012 Bronx 15 1414774
## 7 2012 Richmond 15 470978
## 8 2012 Westchester 10 961073
## 9 2012 Erie 9 920792
## 10 2012 Multiple 6 NA
## # ℹ 31 more rows
datajoinrate <- datajoin |>
mutate(rate = sum/population*100000) |>
arrange(desc(rate))
datajoinrate
## # A tibble: 41 × 5
## # Groups: year [1]
## year county sum population rate
## <dbl> <chr> <dbl> <dbl> <dbl>
## 1 2012 Kings 126 2572282 4.90
## 2 2012 Suffolk 57 1499382 3.80
## 3 2012 New York 61 1625121 3.75
## 4 2012 Richmond 15 470978 3.18
## 5 2012 Nassau 33 1350748 2.44
## 6 2012 Queens 46 2278024 2.02
## 7 2012 Bronx 15 1414774 1.06
## 8 2012 Westchester 10 961073 1.04
## 9 2012 Erie 9 920792 0.977
## 10 2012 Monroe 4 748947 0.534
## # ℹ 31 more rows
dt <- datajoinrate[,c("county","rate")]
dt
## # A tibble: 41 × 2
## county rate
## <chr> <dbl>
## 1 Kings 4.90
## 2 Suffolk 3.80
## 3 New York 3.75
## 4 Richmond 3.18
## 5 Nassau 2.44
## 6 Queens 2.02
## 7 Bronx 1.06
## 8 Westchester 1.04
## 9 Erie 0.977
## 10 Monroe 0.534
## # ℹ 31 more rows
essay
The Hate Crime 2010 data set is notable for its comprehensiveness and depth, with an extensive set of variables which records covering a wide range of hate crimes. Its comprehensive coverage guarantees that it catches every one of these crimes so it will provide a precise picture of their prevalence and characteristics across several jurisdictions.
One of the data set’s significant benefits is the inclusion of numerous counties, which improves its representativeness and enables deeper insights into hate crime patterns at both the local and regional levels. The data collection provides a more thorough knowledge of the occurrence and trends of hate crimes by pulling from a wide variety of geographic locations, which allows an analysis of inequalities and distinctions among various populations.
While the Hate Crime 2010 data set provides useful insights into the prevalence and nature of hate crimes, one issue is the lack of transparency in the data collection process. Hate crimes are typically reported and identified by law enforcement officers who have been trained to recognize such incidents and follow applicable laws and reporting protocols. However, despite reports from trustworthy government agencies such as the FBI in the United States and national statistical agencies in other countries, the possibility of bias or error in data collection cannot be dismissed. Human judgment is important in identifying and categorizing hate crimes, but there may be mistakes and confusions that affect the data’s accuracy and reliability. Therefore, while the data set offers useful information, caution should be exercised when interpreting its findings, and efforts to reduce potential biases in data collection should be prioritized in order to improve its credibility and usefulness for research and policymaking.
By identifying which groups are most frequently targeted, researchers can gain insight into the motivations, attitudes, and beliefs that drive people to commit such acts of violence. This investigation looks into the role of prejudice and stereotypes, the impact of group dynamics and socialization processes, individual-level factors like personality traits and past experiences, and the interaction between individual motivations and broader socio-cultural contexts. Unraveling these complexities can help to inform targeted interventions and preventive strategies for addressing the underlying causes of hate-motivated violence and fostering a more inclusive society.
Secondly, the availability of hate crime data with geographical specifics allows researchers to conduct extensive analyses of the contextual elements that influence hate crime rates at the state level. Researchers can gain complex insights into the structural processes that contribute to hate crimes by investigating the socioeconomic, demographic, and political characteristics of states with higher incidence. Additionally In order to determine how economic marginalization contributes to intergroup conflict, it is necessary to examine economic circumstances, such as income disparity and resource availability. It is possible to investigate demographic variables like religious variety and racial makeup to learn more about how cultural dynamics affect the prevalence of hate crimes.
After seeing these results, I strongly support giving top priority to studies that attempt to fully comprehend the dynamics and underlying causes of hate crimes. Getting comprehensive information about hate crime trends and events is essential for creating methods for intervention and prevention that work. Furthermore, it is important that we raise awareness and educate our communities about the groups that are most frequently the targets of hate crimes. In order to foster empathy, understanding, and respect for diversity, it is necessary to conduct projects in a variety of environments. We can attempt to decrease the occurrence of hate-motivated violence and promote greater unity in society by promoting a diverse and supportive culture.