I.C.E stands for Immigration and Custom Enforcement. Their duty is to enforce federal laws regarding border patrol customs and immigration within the United States. They primarily detain any illegal immigrants that have lived in the United States. This project will run a data analysis on the detained people based on country, citizenship country, and birth year.
Categorical data: The data I used to estimate the common victims of ICE arrest was citizenship country. This was chosen because it plays a huge role in the kinds of people that were arrested based on race or ethnicity.
Quantitative data: the data I used were birth years. This would allow me to evaluate which age group was likely to be detained.
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.2.1 ✔ readr 2.2.0
✔ forcats 1.0.1 ✔ stringr 1.6.0
✔ ggplot2 4.0.3 ✔ tibble 3.3.1
✔ lubridate 1.9.5 ✔ tidyr 1.3.2
✔ purrr 1.2.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
Rows: 172515 Columns: 22
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (19): AOR, Apprehension Criminality, Apprehension Date, Event Landmark, ...
dbl (2): Birth Year, Case Threat Level
lgl (1): County
ℹ 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.
# A tibble: 172,515 × 22
AOR County Apprehension Crimina…¹ `Apprehension Date` `Event Landmark`
<chr> <lgl> <chr> <chr> <chr>
1 Harlingen… NA 1 Convicted Criminal 12/31/2022 9:04 SEGOVIA STATE J…
2 Harlingen… NA 2 Pending Criminal Ch… 12/31/2022 8:29 SEGOVIA STATE J…
3 El Paso A… NA 3 Other Immigration V… 12/30/2022 12:14 <NA>
4 Boston Ar… NA 3 Other Immigration V… 12/30/2022 0:07 <NA>
5 Boston Ar… NA 3 Other Immigration V… 12/30/2022 0:07 <NA>
6 Boston Ar… NA 3 Other Immigration V… 12/30/2022 0:07 <NA>
7 Boston Ar… NA 3 Other Immigration V… 12/30/2022 0:07 <NA>
8 Harlingen… NA 1 Convicted Criminal 12/30/2022 10:24 HLG GENERAL ARE…
9 Harlingen… NA 2 Pending Criminal Ch… 12/30/2022 9:03 HLG GENERAL ARE…
10 Dallas Ar… NA 1 Convicted Criminal 12/30/2022 7:30 HALE COUNTY JAIL
# ℹ 172,505 more rows
# ℹ abbreviated name: ¹`Apprehension Criminality`
# ℹ 17 more variables: `Apprehension Method` <chr>, State <chr>, City <chr>,
# `Birth Year` <dbl>, `Case Category` <chr>, `Case Status` <chr>,
# `Case Threat Level` <dbl>, `Citizenship Country` <chr>,
# `Departed Date` <chr>, `Departure Country` <chr>, `Final Order Date` <chr>,
# `Final Order Yes No` <chr>, `Final Program` <chr>, …
The very first thing I did was load the “tidyverse” in the library. This way I’ll have my datasets loaded to make my work more efficient. I began by loading the dplyr and ggplot2 packages in RStudio to support my visualization. I attempted to set my working directory to the Data 101 folder, where my Ice arrest 2024 CSV file was held. I used the read_csv() function to import the dataset. I used skip = 6 to ignore the first six lines of the file so the system would begin reading the dataset properly. I added Windows-1252 to help RStudio interpret the characters in the dataset. I stored the imported data in an object named Ice_arrest_2024
library(ggplot2)library(dplyr)df <- clean_names <- Ice_arrest_2024 # Count records by citizenship and departure countrycountry_counts <- df %>%filter(!is.na("citizenship_country"),!is.na("department_country")) %>%count('citizenship_country', 'department_country')
My dataset needed to be modified for further visualization so i used the clean command to improve my ice dataset. I had the apprehension method used to remove rows that had the missing values. I started by loading the ggplot2 and dplyr packages to help visualize my ICE arrest dataset. I then created a dataframe called df using my original ICE arrest data. My goal was to clean the column names and organize the records by citizenship country and departure country. I used the filter function to identify records that had information for both country variables, and the count function to calculate the number of records for each combination of countries. After correcting the column in my code, this process would allow me to compare the countries represented in the dataset and prepare the results for further analysis.
<theme> List of 1
$ axis.text.x: <ggplot2::element_text>
..@ family : NULL
..@ face : NULL
..@ italic : chr NA
..@ fontweight : num NA
..@ fontwidth : num NA
..@ colour : NULL
..@ size : NULL
..@ hjust : num 1
..@ vjust : NULL
..@ angle : num 45
..@ lineheight : NULL
..@ margin : NULL
..@ debug : NULL
..@ inherit.blank: logi FALSE
@ complete: logi FALSE
@ validate: logi TRUE
I wanted to create a bar chart to estimate the people detained based on citizenship. First, I selected my cleaned dataset, clean_ice, and placed the Citizenship Country variable on the X-axis. I then used the geom_bar() function to count the number of records for each country. I then used scale_fill_manual() to assign different colors to Mexico, Guatemala, India, Kenya, and El Salvador so the countries could be distinguished visually. I also added a title, axis labels, a source caption, and a legend to make the chart easier to understand. Finally, I applied theme_minimal() to give the graph a cleaner appearance. This visualization helped me compare the number of arrest records across citizenship countries in my dataset. I used the theme() function to customize the appearance of my bar chart. I used axis.text.x to adjust the labels on the X-axis and set angle = 45 to rotate the country names by 45 degrees. I also used hjust = 1 to right-align the labels with their positions on the axis.
For my quantitative data i wanted to do a boxplot describing which age group is mostly detained based on birth year. First, I created a new dataframe called clean_ice from my original dataset. I used the mutate() function along with as.numeric() to convert the Birth Year column into numerical values. Next, I used the filter() function to focus on four citizenship countries: Mexico, Guatemala, India, and Kenya. I also removed records with missing birth year values to make the data suitable for analysis. I used ggplot() and geom_boxplot() to create a boxplot comparing birth year distributions across the four countries. I placed Citizenship Country on the X-axis and Birth Year on the Y-axis. Finally, I added a title, axis labels, a source caption, and a minimal theme.
In conclusion: Overall I used my coding and data visualization to determine which ethnicity was likely a target towards ICE. According to the dataset, it’s Mexico. Mexicans are more likely to be deported or detained than any other Hispanic or foreign country outside the United States. Before visualizing my ICE arrest dataset, I cleaned and organized the data using the tidyverse package in RStudio. I created a new dataframe called “clean_ice” from my original dataset, Ice_arrest_2024. I used the mutate() function with as.numeric() to convert the Birth Year column into numerical values for it to properly analyze the data. After cleaning, I used ggplot() and geom_boxplot() to visualize and compare the birth year distributions across the four selected countries. What I wish to include in my future projects would be more categories such as gender, case status, or event landmarks.