library(magrittr)
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() ──
## ✖ tidyr::extract() masks magrittr::extract()
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ✖ purrr::set_names() masks magrittr::set_names()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
# read files --------------------------------------------------------------
library(readxl)
district <- read_excel("district.xls")
# Create New Data Frame ---------------------------------------------------
new_data_frame = district %>% select(DISTNAME,DPETSPEP,DPFPASPEP)
# Summary -----------------------------------------------------------------
summary(new_data_frame$DPETSPEP)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.00 9.90 12.10 12.27 14.20 51.70
summary(new_data_frame$DPFPASPEP)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0.000 5.800 8.900 9.711 12.500 49.000 5
# Cleaning Data -----------------------------------------------------------
# "DPFPASPEP" (money spent on special education) has zeros 5 NA's
new_data_frame_cleaned=new_data_frame%>%filter(!is.na(DPFPASPEP))
#length of the new cleaned data frame for money spent on special education:
length(new_data_frame_cleaned$DPFPASPEP)
## [1] 1202
# Creating a Point Graph
ggplot(new_data_frame_cleaned,aes(DPETSPEP,DPFPASPEP))+geom_point()

Looking at the point graph,there seems to be a slight (weak)
positive correlation between the % of special education and the $ spent
on special education. When you calculate the correlation mathmetically,
this is proven with the correlation being aroung 37% (weak
correlation).
# Mathmatically calculating the correlation
cor(new_data_frame_cleaned$DPETSPEP,new_data_frame_cleaned$DPFPASPEP)
## [1] 0.3700234