library(readxl)
district<-read_excel("district.xls")
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
#2.)create an R markdown with "DISTNAME", "DPETSPEP", and "DPFPASPEP".
obj2<-district %>% select(DISTNAME,DPETSPEP,DPFPASPEP)
#3.)"summary()" statistics for both DPETSPEP and DFPASPEP.
summary(obj2)
## 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
4.) which variable has missing values? - The variable DPFPASPEP has 5 NA’s.
#5.)remove the missing observations.
obj2_cleaned<-obj2 %>% filter(!is.na(DPFPASPEP))
#How many are left overall? - Originally, there were 1207 observations and after removing NA's, there are now 1202 observations.
#6.) create a point graph to compare DPFPASPEP and DPETSPEP.
ggplot(obj2,aes(DPETSPEP,DPFPASPEP)) + geom_point()
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).
#6.) Are they correlated - No, they are not correlated.
#7.) Do a mathematical check of DPFPASPEP and DPETSPEP. What is the result?
cor(obj2_cleaned$DPETSPEP,obj2_cleaned$DPFPASPEP)
## [1] 0.3700234
8.) How would you interpret these results? - the theory is that the more special education students you have, the more a district spends on the special education department. What it shows it that some districts spend more on a small percentage of special education students while other districts have high percentage of special education students and spend around the same amount as those districts that have small percentages.