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.2     ✔ tibble    3.3.0
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.1
## ✔ purrr     1.1.0     
## ── 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(readxl)

district1<-read_xls("district (1).xls")
districtdata<-district1[c("DISTNAME","DPETSPEP","DPFPASPEP")]
summary(districtdata)
##    DISTNAME            DPETSPEP       DPFPASPEP     
##  Length:1207        Min.   : 0.00   Min.   : 0.000  
##  Class :character   1st Qu.: 9.90   1st Qu.: 5.800  
##  Mode  :character   Median :12.10   Median : 8.900  
##                     Mean   :12.27   Mean   : 9.711  
##                     3rd Qu.:14.20   3rd Qu.:12.500  
##                     Max.   :51.70   Max.   :49.000  
##                                     NA's   :5

##DPFPASPEP is the variable with missing values##

districtdata2<-districtdata|>drop_na(DPFPASPEP)
summary(districtdata2)
##    DISTNAME            DPETSPEP      DPFPASPEP     
##  Length:1202        Min.   : 0.0   Min.   : 0.000  
##  Class :character   1st Qu.: 9.9   1st Qu.: 5.800  
##  Mode  :character   Median :12.2   Median : 8.900  
##                     Mean   :12.3   Mean   : 9.711  
##                     3rd Qu.:14.2   3rd Qu.:12.500  
##                     Max.   :51.7   Max.   :49.000

##After removing the 5 missing observations, there are 1202 left overall##

library(ggplot2)
ggplot(districtdata2,aes(x=DPFPASPEP,y=DPETSPEP)) + geom_point()

cor(districtdata2$DPFPASPEP,districtdata2$DPETSPEP)
## [1] 0.3700234

##Correlation is calculated at approximately .37, meaning there is a slightly positive correlation, however, it is closer to no
correlation##