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 HS GED    File -- with only the columns needed

setwd("C:/Users/BlaiseSevier/Desktop/R Work")

fileGED <- "High School Equivalency (GED).csv"

getwd()
## [1] "C:/Users/BlaiseSevier/Desktop/R Work"
GED.sch <- read.csv(fileGED)

### How to set your working directory 
## In quotation marks, ("C: /Users/BlaiseSevier/Desktop/R Work")

setwd("C:/Users/BlaiseSevier/Desktop/R Work")


###NEW Enrol Numbers
els.k12 <- 5296951
nonel.k12 <- 45625450


#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 


# Reserve code value
# Definition
# -3 | Skip Logic Failure
# -5 | Action Plan
# -6 | Force Certified
# -8 | EDFacts Missing Data
# -9 | Not Applicable / Skipped
# -11 | Suppressed Data

CRDC Survey Information

For more information about the school form see: https://www2.ed.gov/about/offices/list/ocr/docs/2017-18-crdc-school-form.pdf.

TOT_HSEPART_M Student participants in high school equivalency exam preparation Program (LEA): Calculated Male Total TOT_HSEPART_F Student participants in high school equivalency exam preparation Program (LEA): Calculated Female Total LEA_HSEPART_LEP_M Student participants in high school equivalency exam preparation Program (LEA): LEP Male LEA_HSEPART_LEP_F Student participants in high school equivalency exam preparation Program (LEA): LEP Female

Change Code from 0s to 9s

#Code to change the -9s to 0s

GED.sch[GED.sch==-9]<-0

GED.sch[GED.sch==-8]<-0
GED.sch[GED.sch==-9]<-0
GED.sch[GED.sch==-8]<-0
GED.sch[GED.sch==-6]<-0
GED.sch[GED.sch==-5]<-0
GED.sch[GED.sch==-3]<-0

HS GED

Non-English Learner Male Students Enrolled in HS GED Courses

#Computes the total number of a non-English Learner male students in HS GED   courses

#dat$NonELM<- (dat$TOT_ENR_M - dat$TOT_LEPENR_M)

GED.sch$NonELM <- (GED.sch$TOT_HSEPART_M - GED.sch$LEA_HSEPART_LEP_M)

sum(GED.sch$NonELM)
## [1] 31432
#There are 31,432 Non-English Learner Male Students Enrolled in HS GED    

Non-English Learner Female Students in HS GED

#Total female non-EL 
#dat$NonELF <-dat$TOT_ENR_F-dat$TOT_LEPENR_F

GED.sch$NonELF <- (GED.sch$TOT_HSEPART_F - GED.sch$LEA_HSEPART_LEP_F)
sum(GED.sch$NonELF)
## [1] 23490
#There are 23,490 Non-English Learner Females Enrolled in HS GED  courses.

Total Non ELs in HS GED

#total non EL
#dat$NonEL<-dat$NonELF + dat$NonELM

GED.sch$NonEL <- GED.sch$NonELF + GED.sch$NonELM

non.el.GED <- sum(GED.sch$NonEL)
non.el.GED
## [1] 54922
#There are 54,922 Non-English Learners Enrolled in HS GED   

English Learners in HS GED

English Learner Males in HS GED

#Total Lep Male in HS GED   

#dat$ELMGT <- dat$SCH_GTENR_LEP_M

GED.sch$ELM.GED <- GED.sch$LEA_HSEPART_LEP_M

sum(GED.sch$LEA_HSEPART_LEP_M)
## [1] 3184
sum(GED.sch$ELM.GED)
## [1] 3184
## There is 3,184 English Learner Males in HS GED    

English Learner Females in HS GED

#Total LEP Female in GT
#dat$ELFGT <- dat$SCH_GTENR_LEP_F

GED.sch$ELF.GED <- GED.sch$LEA_HSEPART_LEP_F

sum(GED.sch$ELF.GED)
## [1] 2398
## There are 2,398 EL Females in HS GED   Classes 

Total English Learners in HS GED

#dat$ELEnrol <- dat$TOT_LEPENR_M + dat$TOT_LEPENR_F

GED.sch$ELEnrolGED<- GED.sch$ELM.GED + GED.sch$ELF.GED

els.GED <- sum(GED.sch$ELEnrolGED)

sum(els.GED)
## [1] 5582
## There is 5582 English learners in HS GED     

Percentage of ELs and Non ELs in HS GED Courses

#Percetage of ELs in HS GED   in HS is 0.52%

round(els.GED/tot_lep_hs*100,2)
## [1] 0.52
#Percentage of ELs in GED in K-12 0.11%
round(els.GED/els.k12*100,2)
## [1] 0.11
#Percentage of non-ELs in GED is 0.42% in HS
round(non.el.GED/non.el.hs*100,2)
## [1] 0.42
#Percentage of non-ELs in GED in K-12 is 3%
round(non.el.GED/nonel.k12*100,2)
## [1] 0.12