options(scipen = 999)
#Oh my good god it worked. I tried several iterations of this and it just was not working oh hell yes. 
library(readr)
# This line creates the object that R is complaining is missing:
X2020Election <- read_csv("2020Election.csv")
## Rows: 52 Columns: 15
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (6): State, Source, Official/Unofficial, VEP Turnout Rate, % Non-citizen...
## num (9): Total Ballots Counted (Estimate), Vote for Highest Office (Presiden...
## 
## ℹ 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.
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.2.1     ✔ purrr     1.2.2
## ✔ forcats   1.0.1     ✔ stringr   1.6.0
## ✔ ggplot2   4.0.3     ✔ tibble    3.3.1
## ✔ lubridate 1.9.5     ✔ tidyr     1.3.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
read_csv("2020Election.csv")
## Rows: 52 Columns: 15
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (6): State, Source, Official/Unofficial, VEP Turnout Rate, % Non-citizen...
## num (9): Total Ballots Counted (Estimate), Vote for Highest Office (Presiden...
## 
## ℹ 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: 52 × 15
##    State                Source      `Official/Unofficial` Total Ballots Counte…¹
##    <chr>                <chr>       <chr>                                  <dbl>
##  1 United States        <NA>        <NA>                               158835004
##  2 Alabama              https://ww… Unofficial                           2306587
##  3 Alaska               https://ww… <NA>                                  367000
##  4 Arizona              https://re… <NA>                                 3400000
##  5 Arkansas             https://re… Unofficial                           1212030
##  6 California           https://el… Unofficial                          16800000
##  7 Colorado             https://re… <NA>                                 3295000
##  8 Connecticut          <NA>        <NA>                                 1850000
##  9 Delaware             https://el… Unofficial                            507805
## 10 District of Columbia https://el… <NA>                                  350000
## # ℹ 42 more rows
## # ℹ abbreviated name: ¹​`Total Ballots Counted (Estimate)`
## # ℹ 11 more variables: `Vote for Highest Office (President)` <dbl>,
## #   `VEP Turnout Rate` <chr>, `Voting-Eligible Population (VEP)` <dbl>,
## #   `Voting-Age Population (VAP)` <dbl>, `% Non-citizen` <chr>, Prison <dbl>,
## #   Probation <dbl>, Parole <dbl>, `Total Ineligible Felon` <dbl>,
## #   `Overseas Eligible` <dbl>, `State Abv` <chr>
  1. summary(data$x)

  2. hist(data$x) - for continuous variables

  3. plot(data\(x,data\)y) - to compare variables

(ggplot is fine if you are comfortable with it)

  1. cor(data\(x,data\)y) - to see a correlation between two variables
data1<-(X2020Election[-1,])

summary(data1)
##        State          Source   Official/Unofficial
##  Length   :51   Length   :51   Length   :51       
##  N.unique :51   N.unique :40   N.unique : 2       
##  N.blank  : 0   N.blank  : 0   N.blank  : 0       
##  Min.nchar: 4   Min.nchar:23   Min.nchar: 8       
##  Max.nchar:20   Max.nchar:99   Max.nchar:10       
##                 NAs      :11   NAs      :26       
##                                                   
##  Total Ballots Counted (Estimate) Vote for Highest Office (President)
##  Min.   :  278503                 Min.   :  276765                   
##  1st Qu.:  867500                 1st Qu.:  753784                   
##  Median : 2155000                 Median : 1447106                   
##  Mean   : 3114412                 Mean   : 2178698                   
##  3rd Qu.: 3912500                 3rd Qu.: 2638094                   
##  Max.   :16800000                 Max.   :11231799                   
##                                   NAs    :27                         
##   VEP Turnout Rate Voting-Eligible Population (VEP) Voting-Age Population (VAP)
##  Length   :51      Min.   :  431364                 Min.   :  447915           
##  N.unique :47      1st Qu.: 1338126                 1st Qu.: 1403390           
##  N.blank  : 0      Median : 3312250                 Median : 3479257           
##  Min.nchar: 5      Mean   : 4600645                 Mean   : 5051080           
##  Max.nchar: 5      3rd Qu.: 5313422                 3rd Qu.: 5934260           
##                    Max.   :25962648                 Max.   :30783255           
##                                                                                
##    % Non-citizen     Prison         Probation          Parole      
##  Length   :51    Min.   :     0   Min.   :     0   Min.   :     0  
##  N.unique :37    1st Qu.:  6080   1st Qu.:     0   1st Qu.:     0  
##  N.blank  : 0    Median : 18099   Median :  5989   Median :  1860  
##  Min.nchar: 4    Mean   : 23719   Mean   : 38167   Mean   :  9972  
##  Max.nchar: 5    3rd Qu.: 31208   3rd Qu.: 42236   3rd Qu.: 10066  
##                  Max.   :154913   Max.   :416771   Max.   :109213  
##                                                                    
##  Total Ineligible Felon Overseas Eligible     State Abv 
##  Min.   :     0         Min.   : NA       Length   :51  
##  1st Qu.: 11590         1st Qu.: NA       N.unique :51  
##  Median : 33933         Median : NA       N.blank  : 0  
##  Mean   : 57354         Mean   :NaN       Min.nchar: 2  
##  3rd Qu.: 73060         3rd Qu.: NA       Max.nchar: 2  
##  Max.   :492390         Max.   : NA                     
##                         NAs    :51
  1. hist(data$x) - for continuous variables
hist(data1$`Voting-Eligible Population (VEP)`)

  1. plot(data\(x,data\)y) - to compare variables
plot(data1$`Voting-Eligible Population (VEP)`,data1$`Total Ballots Counted (Estimate)`) 

4) cor(data\(x,data\)y) - to see a correlation between two variables

cor(data1$`Voting-Eligible Population (VEP)`,data1$`Total Ballots Counted (Estimate)`)
## [1] 0.9955596