library(readxl)
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
district<-read_excel("district.xls")
newdata <- district[,c("DISTNAME","DPETSPEP","DPFPASPEP")]
summary(newdata$DPETSPEP)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.00 9.90 12.10 12.27 14.20 51.70
summary(newdata$DPFPASPEP)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0.000 5.800 8.900 9.711 12.500 49.000 5
# The variable with missing values is "DPFPASPEP"
# It has 5 NA'S
newdata_clean<-na.omit(newdata)
summary(newdata_clean$DPFPASPEP)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.000 5.800 8.900 9.711 12.500 49.000
#newdata_clean. = 1202 obs. are left over
ggplot(newdata_clean,aes(x=DPFPASPEP,y=DPETSPEP)) + geom_point()

#The graph shows a weak correlation
cor(newdata_clean$DPFPASPEP,newdata_clean$DPETSPEP)
## [1] 0.3700234
#My interpretation of the results is that is had a moderate positive correlations between both variables.
#Both variables are increasing but the relationship is not strong.