knitr::opts_chunk$set(echo = TRUE)
library(ggplot2)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(tidyr)
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.0 --
## v tibble 3.0.4 v stringr 1.4.0
## v readr 1.4.0 v forcats 0.5.0
## v purrr 0.3.4
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(knitr)
#reading in merged Physics File -- with only the columns needed
setwd("C:/Users/BlaiseSevier/Desktop/R Work")
filePhy <- "Physics.csv"
getwd()
## [1] "C:/Users/BlaiseSevier/Desktop/R Work"
Phy.sch <- read.csv(filePhy)
### How to set your working directory
## In quotation marks, ("C: /Users/BlaiseSevier/Desktop/R Work")
setwd("C:/Users/BlaiseSevier/Desktop/R Work")
els.k12 <- 5296851
nonel.k12 <- 45625438
#Total Number of Students in HS
tot_enrol_hs <- 14183488
#Total Number of Non-Els in HS
non.el.hs <- 13108063
#Total Number of LEP in HS
tot_lep_hs <- 1075425
For more information about the school form see: https://www2.ed.gov/about/offices/list/ocr/docs/2017-18-crdc-school-form.pdf.
TOT_SCIENR_PHYS_M Students Enrolled in Physics: Calculated Male Total TOT_SCIENR_PHYS_F Students Enrolled in Physics: Calculated Female Total SCH_SCIENR_PHYS_LEP_M Students Enrolled in Physics: LEP Male SCH_SCIENR_PHYS_LEP_F Students Enrolled in Physics: LEP Female
#Code to change the -9s to 0s
Phy.sch[Phy.sch==-9]<-0
#Computes the total number of a non-English Learner male students in Physics courses
#dat$NonELM<- (dat$TOT_ENR_M - dat$TOT_LEPENR_M)
Phy.sch$NonELM <- (Phy.sch$TOT_SCIENR_PHYS_M - Phy.sch$SCH_SCIENR_PHYS_LEP_M)
sum(Phy.sch$NonELM)
## [1] 856816
#There are 856,816 Non-English Learner Male Students Enrolled in Physics
#Total female non-EL
#dat$NonELF <-dat$TOT_ENR_F-dat$TOT_LEPENR_F
Phy.sch$NonELF <- (Phy.sch$TOT_SCIENR_PHYS_F - Phy.sch$SCH_SCIENR_PHYS_LEP_F)
sum(Phy.sch$NonELF)
## [1] 727532
#There are 727,532 Non-English Learner Females Enrolled in Physics courses.
#total non EL
#dat$NonEL<-dat$NonELF + dat$NonELM
Phy.sch$NonEL <- Phy.sch$NonELF + Phy.sch$NonELM
non.el.Phy <- sum(Phy.sch$NonEL)
non.el.Phy
## [1] 1584348
#There are 1,584,348 Non-English Learners Enrolled in Physics
#Total Lep Male in Physics
#dat$ELMGT <- dat$SCH_GTENR_LEP_M
Phy.sch$ELM.Phy <- Phy.sch$SCH_SCIENR_PHYS_LEP_M
sum(Phy.sch$SCH_SCIENR_PHYS_LEP_M)
## [1] 45871
sum(Phy.sch$ELM.Phy)
## [1] 45871
## There is 45,871 English Learner Males in Physics
#Total LEP Female in GT
#dat$ELFGT <- dat$SCH_GTENR_LEP_F
Phy.sch$ELF.Phy <- Phy.sch$SCH_SCIENR_PHYS_LEP_F
sum(Phy.sch$ELF.Phy)
## [1] 33637
## There are 33,637 EL Females in Physics Classes
#dat$ELEnrol <- dat$TOT_LEPENR_M + dat$TOT_LEPENR_F
Phy.sch$ELEnrolPhy<- Phy.sch$ELM.Phy + Phy.sch$ELF.Phy
els.Phy <- sum(Phy.sch$ELEnrolPhy)
sum(els.Phy)
## [1] 79508
## There is 79,508 English learners in Physics
#Percetage of ELs in Physics in HS is 7%
round(els.Phy/tot_lep_hs*100,2)
## [1] 7.39
#Percentage of ELs in Phy in K-12 1.5%
round(els.Phy/els.k12*100,2)
## [1] 1.5
#Percentage of non-ELs in Phy is 12% in HS
round(non.el.Phy/non.el.hs*100,2)
## [1] 12.09
#Percentage of non-ELs in Phy in K-12 is 3%
round(non.el.Phy/nonel.k12*100,2)
## [1] 3.47