Questions

  1. create an Rmarkdown document with “district” data
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.4     ✔ 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
library(readxl)

district.xls<-read_xls("district.xls")
  1. create a new data frame with “DISTNAME”, “DPETSPEP” (percent special education) and “DPFPASPEP” (money spent on special education). call the dataframe whatever you want
District2ndlook<-district.xls%>% select(DISTNAME,DPETSPEP,DPFPASPEP)
  1. give me “summary()” statistics for both DPETSPEP and DFPASPEP. You can summarize them separately if you want.
summary(District2ndlook$DPETSPEP)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00    9.90   12.10   12.27   14.20   51.70
summary(District2ndlook$DPFPASPEP)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##   0.000   5.800   8.900   9.711  12.500  49.000       5
  1. Which variable has missing values?

As can be seen here from the summary computes, the variable DPFPASPEP shows 5 NA’s.

  1. remove the missing observations. How many are left overall?
District2ndlook_cleaned<-District2ndlook %>% filter(DPFPASPEP>0)
summary(District2ndlook_cleaned$DPFPASPEP)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.200   5.800   8.900   9.719  12.500  49.000
  1. Create a point graph (hint: ggplot + geom_point()) to compare DPFPASPEP and DPETSPEP. Are they correlated?
ggplot(District2ndlook_cleaned,aes(DPETSPEP,DPFPASPEP))+geom_point()

The plot graph shows the two variables overlayed. They seem to primarily occupy the same space and therefore be correlated.

  1. Do a mathematical check (cor()) of DPFPASPEP and DPETSPEP. What is the result?
a<-ggplot(District2ndlook_cleaned,aes(DPETSPEP,DPFPASPEP))+geom_point()
(cor(District2ndlook_cleaned$DPETSPEP,District2ndlook_cleaned$DPFPASPEP))
## [1] 0.371033
  1. How would you interpret these results? (No real right or wrong answer – just tell me what you see)

The value of 0.37 shows a weak correlation as the value is not close to 1. More research can be done to see the interaction of these two variables.