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.4.4 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ tidyr 1.3.0
✔ 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(dplyr)
library(readr)
library(plotly)
Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
library(broom)
library(magrittr)
Attaching package: 'magrittr'
The following object is masked from 'package:purrr':
set_names
The following object is masked from 'package:tidyr':
extract
# Load data set
data <- readr::read_csv("/Users/jasonlaucel/Data 110 Folder/2023_0824_plcy_state_immigration_data_sheets_fy2022/2023_0824_plcy_state_immigration_data_sheets_fy2022 2/All States Totals 2022-Table 1 7.csv")New names:
Rows: 52 Columns: 16
── Column specification
──────────────────────────────────────────────────────── Delimiter: "," chr
(1): States dbl (15): Population, Lawful Permanent Residents, Lawful Permanent
Residents...
ℹ 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.
• `Rank` -> `Rank...6`
• `Rank` -> `Rank...8`
head(data)# A tibble: 6 × 16
States Population Lawful Permanent Res…¹ Lawful Permanent Res…² `New Arrivals`
<chr> <dbl> <dbl> <dbl> <dbl>
1 Alaba… 5074296 3747 34 1655
2 Alaska 733583 673 49 386
3 Arizo… 7359197 16984 15 7156
4 Arkan… 3045637 3391 35 1419
5 Calif… 39029342 182921 1 78493
6 Color… 5839926 11410 17 5266
# ℹ abbreviated names: ¹`Lawful Permanent Residents`,
# ²`Lawful Permanent Residents Rank`
# ℹ 11 more variables: Rank...6 <dbl>, Adjustments <dbl>, Rank...8 <dbl>,
# Nonimmigrants <dbl>, `Nonimmigrants Rank` <dbl>, Naturalizations <dbl>,
# `Naturalizations Rank` <dbl>, Refugees <dbl>, `Refugees Rank` <dbl>,
# Asylees <dbl>, `Asylee Rank` <dbl>