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

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

fileBio <- "Biology.csv"

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

### 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

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_SCIENR_BIOL_M Students Enrolled in Biology: Calculated Male Total TOT_SCIENR_BIOL_F Students Enrolled in Biology: Calculated Female Total SCH_MATHENR_CALC_LEP_M Students Enrolled in Biology: LEP Male SCH_MATHENR_CALC_LEP_F Students Enrolled in Biology: LEP Female

Change Code from 0s to 9s

#Code to change the -9s to 0s

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

Biology

Non-English Learner Male Students Enrolled in Biology Courses

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

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

Bio.sch$NonELM <- (Bio.sch$TOT_SCIENR_BIOL_M - Bio.sch$SCH_SCIENR_BIOL_LEP_M)

sum(Bio.sch$NonELM)
## [1] 2079640
#There are 2,079,640 Non-English Learner Male Students Enrolled in Biology  

Non-English Learner Female Students in Biology

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

Bio.sch$NonELF <- (Bio.sch$TOT_SCIENR_BIOL_F - Bio.sch$SCH_SCIENR_BIOL_LEP_F)
sum(Bio.sch$NonELF)
## [1] 2161112
#There are 2,161,112 Non-English Learner Females Enrolled in Biology  courses.

Total Non ELs in Biology

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

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

non.el.Bio <- sum(Bio.sch$NonEL)
non.el.Bio
## [1] 4240752
#There are   4,240,752 Non-English Learners Enrolled in Biology 

English Learners in Biology

English Learner Males in Biology

#Total Lep Male in Biology 

#dat$ELMGT <- dat$SCH_GTENR_LEP_M

Bio.sch$ELM.Bio <- Bio.sch$SCH_SCIENR_BIOL_LEP_M

sum(Bio.sch$SCH_SCIENR_BIOL_LEP_M)
## [1] 169273
sum(Bio.sch$ELM.Bio)
## [1] 169273
## There is 169,273 English Learner Males in Biology  

English Learner Females in Biology

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

Bio.sch$ELF.Bio <- Bio.sch$SCH_SCIENR_BIOL_LEP_F

sum(Bio.sch$ELF.Bio)
## [1] 131211
## There are 131,211 EL Females in Biology Classes 

Total English Learners in Biology

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

Bio.sch$ELEnrolBio<- Bio.sch$ELM.Bio + Bio.sch$ELF.Bio

els.Bio <- sum(Bio.sch$ELEnrolBio)

sum(els.Bio)
## [1] 300484
## There is 300,484 English learners in Biology   

Percentage of ELs and Non ELs in Biology Courses

round(els.Bio/els.k12*100,2)
## [1] 5.67
round(non.el.Bio/nonel.k12*100,2)
## [1] 9.29