This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
library(readxl)
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(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats 1.0.0 ✔ readr 2.1.5
## ✔ ggplot2 3.5.1 ✔ stringr 1.5.1
## ✔ lubridate 1.9.3 ✔ tibble 3.2.1
## ✔ purrr 1.0.2 ✔ tidyr 1.3.1
## ── 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(rstatix)
##
## Attaching package: 'rstatix'
##
## The following object is masked from 'package:stats':
##
## filter
library(ggplot2)
library(openxlsx)
Visualization 1: Heatmaps by Borough Load Packages
if (!requireNamespace("BiocManager", quietly=TRUE))
install.packages("BiocManager")
BiocManager::install("ComplexHeatmap")
## Bioconductor version 3.20 (BiocManager 1.30.25), R 4.4.1 (2024-06-14)
## Warning: package(s) not installed when version(s) same as or greater than current; use
## `force = TRUE` to re-install: 'ComplexHeatmap'
## Old packages: 'clue', 'curl', 'hexbin', 'terra'
library(ComplexHeatmap)
## Loading required package: grid
## ========================================
## ComplexHeatmap version 2.22.0
## Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
## Github page: https://github.com/jokergoo/ComplexHeatmap
## Documentation: http://jokergoo.github.io/ComplexHeatmap-reference
##
## If you use it in published research, please cite either one:
## - Gu, Z. Complex Heatmap Visualization. iMeta 2022.
## - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional
## genomic data. Bioinformatics 2016.
##
##
## The new InteractiveComplexHeatmap package can directly export static
## complex heatmaps into an interactive Shiny app with zero effort. Have a try!
##
## This message can be suppressed by:
## suppressPackageStartupMessages(library(ComplexHeatmap))
## ========================================
Read in the data from the website
# sheet 4: "Ethnicity"
dat = read.xlsx("https://infohub.nyced.org/docs/default-source/default-document-library/district-ela-results-2013-2019-(public).xlsx", sheet=4)
Data Cleaning
head(dat)
## District Grade Year Category Number.Tested Mean.Scale.Score #.Level.1
## 1 1 3 2013 Asian 191 320.0104675 27
## 2 1 3 2014 Asian 180 316.22778319999998 44
## 3 1 3 2015 Asian 184 317.2010803 37
## 4 1 3 2016 Asian 174 329.79885860000002 17
## 5 1 3 2017 Asian 145 327.5310364 23
## 6 1 3 2018 Asian 161 613.54656980000004 15
## %.Level.1 #.Level.2 %.Level.2 #.Level.3 %.Level.3
## 1 14.13612556 63 32.984294890000001 77 40.314136509999997
## 2 24.444444659999998 47 26.11111069 65 36.111110689999997
## 3 20.10869598 54 29.347826000000001 64 34.782608029999999
## 4 9.7701148989999993 41 23.563219069999999 80 45.977012629999997
## 5 15.86206913 28 19.310344700000002 55 37.931034089999997
## 6 9.3167705539999996 30 18.633541109999999 69 42.857143399999998
## #.Level.4 %.Level.4 #.Level.3+4 %.Level.3+4
## 1 24 12.56544495 101 52.879581450000003
## 2 24 13.33333302 89 49.44444275
## 3 29 15.760869980000001 93 50.543479920000003
## 4 36 20.689655299999998 116 66.666664119999993
## 5 39 26.896551129999999 94 64.827583309999994
## 6 47 29.192546839999999 116 72.049690249999998
# descriptive stats
summary(dat)
## District Grade Year Category
## Min. : 1.00 Length:6272 Min. :2013 Length:6272
## 1st Qu.: 8.75 Class :character 1st Qu.:2014 Class :character
## Median :16.50 Mode :character Median :2016 Mode :character
## Mean :16.50 Mean :2016
## 3rd Qu.:24.25 3rd Qu.:2018
## Max. :32.00 Max. :2019
## Number.Tested Mean.Scale.Score #.Level.1 %.Level.1
## Min. : 2.0 Length:6272 Length:6272 Length:6272
## 1st Qu.: 123.0 Class :character Class :character Class :character
## Median : 406.0 Mode :character Mode :character Mode :character
## Mean : 883.1
## 3rd Qu.: 920.5
## Max. :17288.0
## #.Level.2 %.Level.2 #.Level.3 %.Level.3
## Length:6272 Length:6272 Length:6272 Length:6272
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## #.Level.4 %.Level.4 #.Level.3+4 %.Level.3+4
## Length:6272 Length:6272 Length:6272 Length:6272
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
# generate frequency tables for variables Category, Grade, and Year
table(dat$Category)
##
## Asian Black Hispanic White
## 1568 1568 1568 1568
table(dat$Grade)
##
## 3 4 5 6 7 8 All Grades
## 896 896 896 896 896 896 896
table(dat$Year)
##
## 2013 2014 2015 2016 2017 2018 2019
## 896 896 896 896 896 896 896
Missing values
# retain observations without "s"
ela <- dat %>%
filter(Mean.Scale.Score != "s") %>% # suppressed cells are removed
mutate(mean_scale_score = as.numeric(Mean.Scale.Score)) # change data type from character to numeric
Replication of Heat Map: Extension of by Borough Instead of District, Black Students
elanew <- ela |>
filter(Category == "Black", Grade == 8) |>
group_by(Year) |>
mutate(borough = c("Manhattan", "Manhattan", "Manhattan", "Manhattan", "Manhattan", "Manhattan",
"Bronx", "Bronx", "Bronx", "Bronx", "Bronx", "Bronx",
"Brooklyn", "Brooklyn", "Brooklyn", "Brooklyn", "Brooklyn", "Brooklyn",
"Brooklyn", "Brooklyn", "Brooklyn", "Brooklyn", "Brooklyn",
"Queens", "Queens", "Queens", "Queens", "Queens", "Queens", "Queens",
"Staten Island", "Brooklyn")) |>
relocate("District", "borough")
# select years (2013-2017), grade (8), and category (Black)
elanew1 <- elanew %>%
filter(Year == 2013 | Year == 2014 | Year == 2015 | Year == 2016 | Year == 2017, Grade == 8, Category == "Black") %>%
group_by(borough, Year) %>%
summarise(avg_score = mean(mean_scale_score, na.rm = TRUE)) %>%
ungroup() %>%
select(avg_score, borough, Year) %>%
pivot_wider(names_from = Year, values_from = avg_score) # reorganize the data from long to wide
## `summarise()` has grouped output by 'borough'. You can override using the
## `.groups` argument.
elanew1
## # A tibble: 5 × 6
## borough `2013` `2014` `2015` `2016` `2017`
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Bronx 277. 282. 283. 292. 297.
## 2 Brooklyn 286. 290. 292. 300. 305.
## 3 Manhattan 284. 287. 289. 296. 301.
## 4 Queens 289. 293. 295. 302. 307.
## 5 Staten Island 280. 282. 287. 293. 298.
# not including District numbers in the calculation
ht_datnew1 <- elanew1 %>% select(-borough) %>% as.data.frame()
ht_datnew1
## 2013 2014 2015 2016 2017
## 1 277.3189 281.8384 282.5528 292.0664 296.6793
## 2 286.4336 290.0213 292.4794 300.3009 305.1059
## 3 284.0865 287.3944 289.4461 295.9889 300.6930
## 4 288.6794 292.6343 295.2542 301.5898 306.9633
## 5 280.0610 281.5453 286.8393 292.7917 297.6309
# add district numbers
rownames(ht_datnew1) <- elanew1$borough
# create heatmap1
plot(Heatmap(as.matrix(ht_datnew1), # convert the data frame to a matrix
heatmap_legend_param = list(title = "Grade 8 ELA: Black Students Heatmap",
title_gp = gpar(fontfamily = "Times"),
labels_gp = gpar(fontfamily = "Times")), # heatmap name
rect_gp = gpar(col = "white", lwd = 1), # separate the cells by white lines
cluster_columns = FALSE, # cluster rows only; the default distance metric - “euclidean”, and the default agglomeration (clustering) method - “complete”
row_names_gp = gpar(fontfamily = "Times"),
column_names_gp = gpar(fontfamily = "Times")))
Hispanic Students
elanew2 <- ela |>
filter(Category == "Hispanic", Grade == 8) |>
group_by(Year) |>
mutate(borough = c("Manhattan", "Manhattan", "Manhattan", "Manhattan", "Manhattan", "Manhattan",
"Bronx", "Bronx", "Bronx", "Bronx", "Bronx", "Bronx",
"Brooklyn", "Brooklyn", "Brooklyn", "Brooklyn", "Brooklyn", "Brooklyn",
"Brooklyn", "Brooklyn", "Brooklyn", "Brooklyn", "Brooklyn",
"Queens", "Queens", "Queens", "Queens", "Queens", "Queens", "Queens",
"Staten Island", "Brooklyn")) |>
relocate("District", "borough")
# select years (2013-2017), grade (8), and category (Black)
elanew2 <- elanew2 %>%
filter(Year == 2013 | Year == 2014 | Year == 2015 | Year == 2016 | Year == 2017, Grade == 8, Category == "Hispanic") %>%
group_by(borough, Year) %>%
summarise(avg_score = mean(mean_scale_score, na.rm = TRUE)) %>%
ungroup() %>%
select(avg_score, borough, Year) %>%
pivot_wider(names_from = Year, values_from = avg_score) # reorganize the data from long to wide
## `summarise()` has grouped output by 'borough'. You can override using the
## `.groups` argument.
# not including District numbers in the calculation
ht_datnew2 <- elanew2 %>% select(-borough) %>% as.data.frame()
ht_datnew2
## 2013 2014 2015 2016 2017
## 1 277.4004 280.8403 283.1764 292.3683 297.3517
## 2 282.5836 287.8735 290.5039 297.2990 300.8665
## 3 287.9317 291.4804 292.7804 298.3915 303.3309
## 4 293.6943 296.0435 297.0393 304.3804 306.0386
## 5 289.2070 290.3224 295.0556 299.1154 302.7409
# add district numbers
rownames(ht_datnew2) <- elanew1$borough
# create heatmap1
plot(Heatmap(as.matrix(ht_datnew2), # convert the data frame to a matrix
heatmap_legend_param = list(title = "Grade 8 ELA: Black Students Heatmap",
title_gp = gpar(fontfamily = "Times"),
labels_gp = gpar(fontfamily = "Times")), # heatmap name
rect_gp = gpar(col = "white", lwd = 1), # separate the cells by white lines
cluster_columns = FALSE, # cluster rows only; the default distance metric - “euclidean”, and the default agglomeration (clustering) method - “complete”
row_names_gp = gpar(fontfamily = "Times"),
column_names_gp = gpar(fontfamily = "Times")))
Visualization 2: Ridgeline Plots of Black/Hispanic Male Students by Borough
# load packages
library(readxl)
library(dplyr)
library(tidyverse)
library(ggplot2)
library(ggridges)
# load data
sqr <- "SQR1.xlsx"
sqr_tab_names <- excel_sheets(path = sqr)
list_sqr <- lapply(sqr_tab_names, function(x) read_excel(path = sqr, sheet = x))
list_sqr
## [[1]]
## # A tibble: 58 × 3
## DBN School Grad_BHM
## <chr> <chr> <dbl>
## 1 01M458 Forsyth Satellite Academy 0.408
## 2 01M515 Lower East Side Preparatory High School NA
## 3 01M650 Cascades High School 0.7
## 4 02M313 James Baldwin School, The: A School for Expedition 0.267
## 5 02M394 EMMA LAZARUS HIGH SCHOOL 0.474
## 6 02M432 Murray Hill Academy NA
## 7 02M544 Independence High School 0.217
## 8 02M550 Liberty High School Academy for Newcomers NA
## 9 02M560 High School M560 - City As School 0.474
## 10 02M565 Urban Academy Laboratory High School NA
## # ℹ 48 more rows
##
## [[2]]
## # A tibble: 59 × 3
## DBN School Grad_BHM
## <chr> <chr> <dbl>
## 1 01M458 Forsyth Satellite Academy 0.257
## 2 01M515 Lower East Side Preparatory High School 0.632
## 3 01M650 Cascades High School 0.448
## 4 02M313 James Baldwin School, The: A School for Expedition 0.478
## 5 02M394 Emma Lazarus High School NA
## 6 02M432 Murray Hill Academy NA
## 7 02M544 Independence High School 0.257
## 8 02M550 Liberty High School Academy for Newcomers 0.4
## 9 02M560 High School M560 - City As School 0.543
## 10 02M565 Urban Academy Laboratory High School NA
## # ℹ 49 more rows
##
## [[3]]
## # A tibble: 59 × 3
## DBN School Grad_BHM
## <chr> <chr> <dbl>
## 1 01M458 Forsyth Satellite Academy 0.375
## 2 01M515 Lower East Side Preparatory High School 0.385
## 3 01M650 Cascades High School 0.724
## 4 02M313 James Baldwin School, The: A School for Expedition 0.385
## 5 02M394 Emma Lazarus High School 0.2
## 6 02M432 Murray Hill Academy 0.308
## 7 02M544 Independence High School 0.323
## 8 02M550 Liberty High School Academy for Newcomers 0.5
## 9 02M560 High School M560 - City As School 0.381
## 10 02M565 Urban Academy Laboratory High School NA
## # ℹ 49 more rows
##
## [[4]]
## # A tibble: 58 × 3
## DBN School Grad_BHM
## <chr> <chr> <dbl>
## 1 01M458 Forsyth Satellite Academy 0.439
## 2 01M515 Lower East Side Preparatory High School 0.344
## 3 01M650 Cascades High School 0.6
## 4 02M313 James Baldwin School, The: A School for Expedition 0.5
## 5 02M394 Emma Lazarus High School NA
## 6 02M544 Independence High School 0.418
## 7 02M550 Liberty High School Academy for Newcomers 0.393
## 8 02M560 High School M560 - City As School 0.5
## 9 02M565 Urban Academy Laboratory High School NA
## 10 02M570 Satellite Academy High School 0.418
## # ℹ 48 more rows
##
## [[5]]
## # A tibble: 55 × 3
## DBN School Grad_BHM
## <chr> <chr> <chr>
## 1 01M458 Forsyth Satellite Academy 0.378
## 2 01M515 Lower East Side Preparatory High School 0.44400000000000001
## 3 01M650 Cascades High School 0.36099999999999999
## 4 02M313 James Baldwin School, The: A School for Expedition 0.52900000000000003
## 5 02M394 Emma Lazarus High School 0.77800000000000002
## 6 02M544 Independence High School 0.33900000000000002
## 7 02M550 Liberty High School Academy for Newcomers 0.33300000000000002
## 8 02M560 High School M560 - City As School 0.435
## 9 02M565 Urban Academy Laboratory High School N<5
## 10 02M570 Satellite Academy High School 0.36799999999999999
## # ℹ 45 more rows
# load sheets; sqr15 means AY 14-15
sqr15 <- list_sqr[[1]]; sqr16 <- list_sqr[[2]]; sqr17 <- list_sqr[[3]];
sqr18 <- list_sqr[[4]]; sqr19 <- list_sqr[[5]]
# add year to each sheet
sqr15$Year <- "2015"; sqr16$Year <- "2016"; sqr17$Year <- "2017";
sqr18$Year <- "2018"; sqr19$Year <- "2019"
# merge data into one dataframe
sqr1 <- as.data.frame(rbind(sqr15, sqr16, sqr17, sqr18, sqr19))
#dim(sqr1519)
#colnames(sqr1519)
#summary(sqr1519)
# convert the column into numeric and drop na values
sqr1519 <- sqr1 %>%
mutate(Grad_BHM = as.numeric(Grad_BHM)) %>%
drop_na()
## Warning: There was 1 warning in `mutate()`.
## ℹ In argument: `Grad_BHM = as.numeric(Grad_BHM)`.
## Caused by warning:
## ! NAs introduced by coercion
# Use pattern matching to find schools in Bronx and add a column Borough
sqr1519$Match <- grepl(pattern = "(^07X|08X|09X|10X|12X)", sqr1519$DBN)
bronx <- sqr1519[sqr1519$Match == TRUE,]
bronx
## DBN School Grad_BHM Year
## 12 07X379 Jill Chaifetz Transfer High School 0.364 2015
## 13 07X381 Bronx Haven High School 0.348 2015
## 14 07X557 Mott Haven Community High School 0.412 2015
## 15 08X377 Bronx Community High School 0.306 2015
## 16 08X537 Bronx Arena High School 0.167 2015
## 17 10X319 Providing Urban Learners Success In Education High 0.391 2015
## 18 10X397 English Language Learners and International Suppor 0.350 2015
## 19 12X446 Arturo A. Schomburg Satellite Academy Bronx 0.290 2015
## 20 12X480 Bronx Regional High School 0.387 2015
## 56 07X379 Jill Chaifetz Transfer High School 0.346 2016
## 57 07X381 Bronx Haven High School 0.471 2016
## 58 07X557 Mott Haven Community High School 0.500 2016
## 59 08X377 Bronx Community High School 0.406 2016
## 60 08X537 Bronx Arena High School 0.235 2016
## 61 10X319 Providing Urban Learners Success In Education High 0.298 2016
## 62 10X397 English Language Learners and International Suppor 0.222 2016
## 63 12X321 Crotona Academy High School 0.267 2016
## 64 12X446 Arturo A. Schomburg Satellite Academy Bronx 0.500 2016
## 65 12X480 Bronx Regional High School 0.265 2016
## 107 07X379 Jill Chaifetz Transfer High School 0.484 2017
## 108 07X381 Bronx Haven High School 0.636 2017
## 109 07X557 Mott Haven Community High School 0.593 2017
## 110 08X377 Bronx Community High School 0.361 2017
## 111 08X537 Bronx Arena High School 0.343 2017
## 112 10X319 Providing Urban Learners Success In Education High 0.262 2017
## 113 10X397 English Language Learners and International Suppor 0.414 2017
## 114 12X321 Crotona Academy High School 0.286 2017
## 115 12X446 Arturo A. Schomburg Satellite Academy Bronx 0.474 2017
## 116 12X480 Bronx Regional High School 0.276 2017
## 159 07X379 Jill Chaifetz Transfer High School 0.314 2018
## 160 07X381 Bronx Haven High School 0.486 2018
## 161 07X557 Mott Haven Community High School 0.468 2018
## 162 08X377 Bronx Community High School 0.438 2018
## 163 08X537 Bronx Arena High School 0.457 2018
## 164 10X319 Providing Urban Learners Success In Education High 0.250 2018
## 165 10X397 English Language Learners and International Suppor 0.537 2018
## 166 12X321 Crotona Academy High School 0.412 2018
## 167 12X446 Arturo A. Schomburg Satellite Academy Bronx 0.379 2018
## 168 12X480 Bronx Regional High School 0.281 2018
## 213 07X379 Jill Chaifetz Transfer High School 0.387 2019
## 214 07X381 Bronx Haven High School 0.357 2019
## 215 07X557 Mott Haven Community High School 0.615 2019
## 216 08X377 Bronx Community High School 0.800 2019
## 217 08X537 Bronx Arena High School 0.261 2019
## 218 10X319 Providing Urban Learners Success In Education High 0.250 2019
## 219 10X397 English Language Learners and International Suppor 0.314 2019
## 220 12X446 Arturo A. Schomburg Satellite Academy Bronx 0.346 2019
## 221 12X480 Bronx Regional High School 0.214 2019
## Match
## 12 TRUE
## 13 TRUE
## 14 TRUE
## 15 TRUE
## 16 TRUE
## 17 TRUE
## 18 TRUE
## 19 TRUE
## 20 TRUE
## 56 TRUE
## 57 TRUE
## 58 TRUE
## 59 TRUE
## 60 TRUE
## 61 TRUE
## 62 TRUE
## 63 TRUE
## 64 TRUE
## 65 TRUE
## 107 TRUE
## 108 TRUE
## 109 TRUE
## 110 TRUE
## 111 TRUE
## 112 TRUE
## 113 TRUE
## 114 TRUE
## 115 TRUE
## 116 TRUE
## 159 TRUE
## 160 TRUE
## 161 TRUE
## 162 TRUE
## 163 TRUE
## 164 TRUE
## 165 TRUE
## 166 TRUE
## 167 TRUE
## 168 TRUE
## 213 TRUE
## 214 TRUE
## 215 TRUE
## 216 TRUE
## 217 TRUE
## 218 TRUE
## 219 TRUE
## 220 TRUE
## 221 TRUE
# remove the match column
bronx[, 5] <- NULL;
bronx
## DBN School Grad_BHM Year
## 12 07X379 Jill Chaifetz Transfer High School 0.364 2015
## 13 07X381 Bronx Haven High School 0.348 2015
## 14 07X557 Mott Haven Community High School 0.412 2015
## 15 08X377 Bronx Community High School 0.306 2015
## 16 08X537 Bronx Arena High School 0.167 2015
## 17 10X319 Providing Urban Learners Success In Education High 0.391 2015
## 18 10X397 English Language Learners and International Suppor 0.350 2015
## 19 12X446 Arturo A. Schomburg Satellite Academy Bronx 0.290 2015
## 20 12X480 Bronx Regional High School 0.387 2015
## 56 07X379 Jill Chaifetz Transfer High School 0.346 2016
## 57 07X381 Bronx Haven High School 0.471 2016
## 58 07X557 Mott Haven Community High School 0.500 2016
## 59 08X377 Bronx Community High School 0.406 2016
## 60 08X537 Bronx Arena High School 0.235 2016
## 61 10X319 Providing Urban Learners Success In Education High 0.298 2016
## 62 10X397 English Language Learners and International Suppor 0.222 2016
## 63 12X321 Crotona Academy High School 0.267 2016
## 64 12X446 Arturo A. Schomburg Satellite Academy Bronx 0.500 2016
## 65 12X480 Bronx Regional High School 0.265 2016
## 107 07X379 Jill Chaifetz Transfer High School 0.484 2017
## 108 07X381 Bronx Haven High School 0.636 2017
## 109 07X557 Mott Haven Community High School 0.593 2017
## 110 08X377 Bronx Community High School 0.361 2017
## 111 08X537 Bronx Arena High School 0.343 2017
## 112 10X319 Providing Urban Learners Success In Education High 0.262 2017
## 113 10X397 English Language Learners and International Suppor 0.414 2017
## 114 12X321 Crotona Academy High School 0.286 2017
## 115 12X446 Arturo A. Schomburg Satellite Academy Bronx 0.474 2017
## 116 12X480 Bronx Regional High School 0.276 2017
## 159 07X379 Jill Chaifetz Transfer High School 0.314 2018
## 160 07X381 Bronx Haven High School 0.486 2018
## 161 07X557 Mott Haven Community High School 0.468 2018
## 162 08X377 Bronx Community High School 0.438 2018
## 163 08X537 Bronx Arena High School 0.457 2018
## 164 10X319 Providing Urban Learners Success In Education High 0.250 2018
## 165 10X397 English Language Learners and International Suppor 0.537 2018
## 166 12X321 Crotona Academy High School 0.412 2018
## 167 12X446 Arturo A. Schomburg Satellite Academy Bronx 0.379 2018
## 168 12X480 Bronx Regional High School 0.281 2018
## 213 07X379 Jill Chaifetz Transfer High School 0.387 2019
## 214 07X381 Bronx Haven High School 0.357 2019
## 215 07X557 Mott Haven Community High School 0.615 2019
## 216 08X377 Bronx Community High School 0.800 2019
## 217 08X537 Bronx Arena High School 0.261 2019
## 218 10X319 Providing Urban Learners Success In Education High 0.250 2019
## 219 10X397 English Language Learners and International Suppor 0.314 2019
## 220 12X446 Arturo A. Schomburg Satellite Academy Bronx 0.346 2019
## 221 12X480 Bronx Regional High School 0.214 2019
# add a Borough column to the data file bronx
bronx$Borough <- "Bronx"
bronx
## DBN School Grad_BHM Year
## 12 07X379 Jill Chaifetz Transfer High School 0.364 2015
## 13 07X381 Bronx Haven High School 0.348 2015
## 14 07X557 Mott Haven Community High School 0.412 2015
## 15 08X377 Bronx Community High School 0.306 2015
## 16 08X537 Bronx Arena High School 0.167 2015
## 17 10X319 Providing Urban Learners Success In Education High 0.391 2015
## 18 10X397 English Language Learners and International Suppor 0.350 2015
## 19 12X446 Arturo A. Schomburg Satellite Academy Bronx 0.290 2015
## 20 12X480 Bronx Regional High School 0.387 2015
## 56 07X379 Jill Chaifetz Transfer High School 0.346 2016
## 57 07X381 Bronx Haven High School 0.471 2016
## 58 07X557 Mott Haven Community High School 0.500 2016
## 59 08X377 Bronx Community High School 0.406 2016
## 60 08X537 Bronx Arena High School 0.235 2016
## 61 10X319 Providing Urban Learners Success In Education High 0.298 2016
## 62 10X397 English Language Learners and International Suppor 0.222 2016
## 63 12X321 Crotona Academy High School 0.267 2016
## 64 12X446 Arturo A. Schomburg Satellite Academy Bronx 0.500 2016
## 65 12X480 Bronx Regional High School 0.265 2016
## 107 07X379 Jill Chaifetz Transfer High School 0.484 2017
## 108 07X381 Bronx Haven High School 0.636 2017
## 109 07X557 Mott Haven Community High School 0.593 2017
## 110 08X377 Bronx Community High School 0.361 2017
## 111 08X537 Bronx Arena High School 0.343 2017
## 112 10X319 Providing Urban Learners Success In Education High 0.262 2017
## 113 10X397 English Language Learners and International Suppor 0.414 2017
## 114 12X321 Crotona Academy High School 0.286 2017
## 115 12X446 Arturo A. Schomburg Satellite Academy Bronx 0.474 2017
## 116 12X480 Bronx Regional High School 0.276 2017
## 159 07X379 Jill Chaifetz Transfer High School 0.314 2018
## 160 07X381 Bronx Haven High School 0.486 2018
## 161 07X557 Mott Haven Community High School 0.468 2018
## 162 08X377 Bronx Community High School 0.438 2018
## 163 08X537 Bronx Arena High School 0.457 2018
## 164 10X319 Providing Urban Learners Success In Education High 0.250 2018
## 165 10X397 English Language Learners and International Suppor 0.537 2018
## 166 12X321 Crotona Academy High School 0.412 2018
## 167 12X446 Arturo A. Schomburg Satellite Academy Bronx 0.379 2018
## 168 12X480 Bronx Regional High School 0.281 2018
## 213 07X379 Jill Chaifetz Transfer High School 0.387 2019
## 214 07X381 Bronx Haven High School 0.357 2019
## 215 07X557 Mott Haven Community High School 0.615 2019
## 216 08X377 Bronx Community High School 0.800 2019
## 217 08X537 Bronx Arena High School 0.261 2019
## 218 10X319 Providing Urban Learners Success In Education High 0.250 2019
## 219 10X397 English Language Learners and International Suppor 0.314 2019
## 220 12X446 Arturo A. Schomburg Satellite Academy Bronx 0.346 2019
## 221 12X480 Bronx Regional High School 0.214 2019
## Borough
## 12 Bronx
## 13 Bronx
## 14 Bronx
## 15 Bronx
## 16 Bronx
## 17 Bronx
## 18 Bronx
## 19 Bronx
## 20 Bronx
## 56 Bronx
## 57 Bronx
## 58 Bronx
## 59 Bronx
## 60 Bronx
## 61 Bronx
## 62 Bronx
## 63 Bronx
## 64 Bronx
## 65 Bronx
## 107 Bronx
## 108 Bronx
## 109 Bronx
## 110 Bronx
## 111 Bronx
## 112 Bronx
## 113 Bronx
## 114 Bronx
## 115 Bronx
## 116 Bronx
## 159 Bronx
## 160 Bronx
## 161 Bronx
## 162 Bronx
## 163 Bronx
## 164 Bronx
## 165 Bronx
## 166 Bronx
## 167 Bronx
## 168 Bronx
## 213 Bronx
## 214 Bronx
## 215 Bronx
## 216 Bronx
## 217 Bronx
## 218 Bronx
## 219 Bronx
## 220 Bronx
## 221 Bronx
# Use pattern matching to find schools in Brooklyn and add a column Borough
sqr1519$Match2 <- grepl(pattern = "(^13K|15K|16K|17K|18K|21K|22K|23K|32K)", sqr1519$DBN)
brooklyn <- sqr1519[sqr1519$Match2 == TRUE,]
brooklyn
## DBN School Grad_BHM Year
## 21 13K553 Brooklyn Academy High School 0.606 2015
## 22 13K575 Bedford Stuyvesant Preparatory High School 0.375 2015
## 23 13K616 Brooklyn High School for Leadership and Community 0.310 2015
## 24 15K529 West Brooklyn Community High School 0.344 2015
## 25 15K698 South Brooklyn Community High School 0.458 2015
## 26 17K489 W.E.B. Dubois Academic High School 0.294 2015
## 27 17K568 Brownsville Academy High School 0.538 2015
## 28 18K578 Brooklyn Bridge Academy 0.455 2015
## 29 18K635 Olympus Academy 0.432 2015
## 30 18K673 East Brooklyn Community High School 0.594 2015
## 31 21K728 Liberation Diploma Plus 0.548 2015
## 32 23K643 Brooklyn Democracy Academy 0.433 2015
## 33 23K646 Aspirations Diploma Plus High School 0.358 2015
## 34 23K647 Metropolitan Diploma Plus High School 0.611 2015
## 40 32K564 Bushwick Community High School 0.203 2015
## 66 13K553 Brooklyn Academy High School 0.619 2016
## 67 13K616 Brooklyn High School for Leadership and Community 0.273 2016
## 68 15K529 West Brooklyn Community High School 0.324 2016
## 69 15K698 South Brooklyn Community High School 0.313 2016
## 70 16K669 Research and Service High School 0.357 2016
## 71 17K489 W.E.B. Dubois Academic High School 0.368 2016
## 72 17K568 Brownsville Academy High School 0.300 2016
## 73 18K578 Brooklyn Bridge Academy 0.531 2016
## 74 18K635 Olympus Academy 0.279 2016
## 75 18K673 East Brooklyn Community High School 0.538 2016
## 76 21K728 Liberation Diploma Plus 0.378 2016
## 77 22K630 Professional Pathways High School 0.563 2016
## 78 23K643 Brooklyn Democracy Academy 0.333 2016
## 79 23K646 Aspirations Diploma Plus High School 0.469 2016
## 80 23K647 Metropolitan Diploma Plus High School 0.543 2016
## 87 32K564 Bushwick Community High School 0.392 2016
## 117 13K553 Brooklyn Academy High School 0.640 2017
## 118 13K575 Bedford Stuyvesant Preparatory High School 0.556 2017
## 119 13K616 Brooklyn High School for Leadership and Community 0.294 2017
## 120 15K529 West Brooklyn Community High School 0.429 2017
## 121 15K698 South Brooklyn Community High School 0.171 2017
## 122 16K669 Research and Service High School 0.375 2017
## 123 17K489 W.E.B. Dubois Academic High School 0.300 2017
## 124 17K568 Brownsville Academy High School 0.625 2017
## 125 18K578 Brooklyn Bridge Academy 0.469 2017
## 126 18K635 Olympus Academy 0.333 2017
## 127 18K673 East Brooklyn Community High School 0.667 2017
## 128 21K728 Liberation Diploma Plus 0.486 2017
## 129 22K630 Professional Pathways High School 0.708 2017
## 130 23K643 Brooklyn Democracy Academy 0.410 2017
## 131 23K646 Aspirations Diploma Plus High School 0.353 2017
## 132 23K647 Metropolitan Diploma Plus High School 0.567 2017
## 139 32K564 Bushwick Community High School 0.329 2017
## 169 13K553 Brooklyn Academy High School 0.577 2018
## 170 13K575 Bedford Stuyvesant Preparatory High School 0.429 2018
## 171 13K616 Brooklyn High School for Leadership and Community 0.310 2018
## 172 15K423 Brooklyn Frontiers High School 0.333 2018
## 173 15K529 West Brooklyn Community High School 0.400 2018
## 174 15K698 South Brooklyn Community High School 0.344 2018
## 175 16K669 Research and Service High School 0.293 2018
## 176 17K489 W.E.B. Dubois Academic High School 0.429 2018
## 177 17K568 Brownsville Academy High School 0.565 2018
## 178 18K578 Brooklyn Bridge Academy 0.561 2018
## 179 18K635 Olympus Academy 0.500 2018
## 180 18K673 East Brooklyn Community High School 0.586 2018
## 181 21K728 Liberation Diploma Plus 0.436 2018
## 182 22K630 Professional Pathways High School 0.444 2018
## 183 23K643 Brooklyn Democracy Academy 0.472 2018
## 184 23K646 Aspirations Diploma Plus High School 0.477 2018
## 185 23K647 Metropolitan Diploma Plus High School 0.630 2018
## 192 32K564 Bushwick Community High School 0.493 2018
## 222 13K553 Brooklyn Academy High School 0.276 2019
## 223 13K616 Brooklyn High School for Leadership and Community 0.296 2019
## 224 15K423 Brooklyn Frontiers High School 0.444 2019
## 225 15K529 West Brooklyn Community High School 0.447 2019
## 226 15K698 South Brooklyn Community High School 0.436 2019
## 227 16K669 Research and Service High School 0.362 2019
## 228 17K568 Brownsville Academy High School 0.583 2019
## 229 17K646 Aspirations Diploma Plus High School 0.333 2019
## 230 18K578 Brooklyn Bridge Academy 0.364 2019
## 231 18K635 Olympus Academy 0.258 2019
## 232 18K673 East Brooklyn Community High School 0.627 2019
## 233 21K728 Liberation Diploma Plus 0.429 2019
## 234 22K630 Professional Pathways High School 0.548 2019
## 235 23K643 Brooklyn Democracy Academy 0.550 2019
## 236 23K647 Metropolitan Diploma Plus High School 0.767 2019
## 243 32K564 Bushwick Community High School 0.500 2019
## Match Match2
## 21 FALSE TRUE
## 22 FALSE TRUE
## 23 FALSE TRUE
## 24 FALSE TRUE
## 25 FALSE TRUE
## 26 FALSE TRUE
## 27 FALSE TRUE
## 28 FALSE TRUE
## 29 FALSE TRUE
## 30 FALSE TRUE
## 31 FALSE TRUE
## 32 FALSE TRUE
## 33 FALSE TRUE
## 34 FALSE TRUE
## 40 FALSE TRUE
## 66 FALSE TRUE
## 67 FALSE TRUE
## 68 FALSE TRUE
## 69 FALSE TRUE
## 70 FALSE TRUE
## 71 FALSE TRUE
## 72 FALSE TRUE
## 73 FALSE TRUE
## 74 FALSE TRUE
## 75 FALSE TRUE
## 76 FALSE TRUE
## 77 FALSE TRUE
## 78 FALSE TRUE
## 79 FALSE TRUE
## 80 FALSE TRUE
## 87 FALSE TRUE
## 117 FALSE TRUE
## 118 FALSE TRUE
## 119 FALSE TRUE
## 120 FALSE TRUE
## 121 FALSE TRUE
## 122 FALSE TRUE
## 123 FALSE TRUE
## 124 FALSE TRUE
## 125 FALSE TRUE
## 126 FALSE TRUE
## 127 FALSE TRUE
## 128 FALSE TRUE
## 129 FALSE TRUE
## 130 FALSE TRUE
## 131 FALSE TRUE
## 132 FALSE TRUE
## 139 FALSE TRUE
## 169 FALSE TRUE
## 170 FALSE TRUE
## 171 FALSE TRUE
## 172 FALSE TRUE
## 173 FALSE TRUE
## 174 FALSE TRUE
## 175 FALSE TRUE
## 176 FALSE TRUE
## 177 FALSE TRUE
## 178 FALSE TRUE
## 179 FALSE TRUE
## 180 FALSE TRUE
## 181 FALSE TRUE
## 182 FALSE TRUE
## 183 FALSE TRUE
## 184 FALSE TRUE
## 185 FALSE TRUE
## 192 FALSE TRUE
## 222 FALSE TRUE
## 223 FALSE TRUE
## 224 FALSE TRUE
## 225 FALSE TRUE
## 226 FALSE TRUE
## 227 FALSE TRUE
## 228 FALSE TRUE
## 229 FALSE TRUE
## 230 FALSE TRUE
## 231 FALSE TRUE
## 232 FALSE TRUE
## 233 FALSE TRUE
## 234 FALSE TRUE
## 235 FALSE TRUE
## 236 FALSE TRUE
## 243 FALSE TRUE
# remove the match columns
brooklyn[, 5:6] <- NULL;
brooklyn
## DBN School Grad_BHM Year
## 21 13K553 Brooklyn Academy High School 0.606 2015
## 22 13K575 Bedford Stuyvesant Preparatory High School 0.375 2015
## 23 13K616 Brooklyn High School for Leadership and Community 0.310 2015
## 24 15K529 West Brooklyn Community High School 0.344 2015
## 25 15K698 South Brooklyn Community High School 0.458 2015
## 26 17K489 W.E.B. Dubois Academic High School 0.294 2015
## 27 17K568 Brownsville Academy High School 0.538 2015
## 28 18K578 Brooklyn Bridge Academy 0.455 2015
## 29 18K635 Olympus Academy 0.432 2015
## 30 18K673 East Brooklyn Community High School 0.594 2015
## 31 21K728 Liberation Diploma Plus 0.548 2015
## 32 23K643 Brooklyn Democracy Academy 0.433 2015
## 33 23K646 Aspirations Diploma Plus High School 0.358 2015
## 34 23K647 Metropolitan Diploma Plus High School 0.611 2015
## 40 32K564 Bushwick Community High School 0.203 2015
## 66 13K553 Brooklyn Academy High School 0.619 2016
## 67 13K616 Brooklyn High School for Leadership and Community 0.273 2016
## 68 15K529 West Brooklyn Community High School 0.324 2016
## 69 15K698 South Brooklyn Community High School 0.313 2016
## 70 16K669 Research and Service High School 0.357 2016
## 71 17K489 W.E.B. Dubois Academic High School 0.368 2016
## 72 17K568 Brownsville Academy High School 0.300 2016
## 73 18K578 Brooklyn Bridge Academy 0.531 2016
## 74 18K635 Olympus Academy 0.279 2016
## 75 18K673 East Brooklyn Community High School 0.538 2016
## 76 21K728 Liberation Diploma Plus 0.378 2016
## 77 22K630 Professional Pathways High School 0.563 2016
## 78 23K643 Brooklyn Democracy Academy 0.333 2016
## 79 23K646 Aspirations Diploma Plus High School 0.469 2016
## 80 23K647 Metropolitan Diploma Plus High School 0.543 2016
## 87 32K564 Bushwick Community High School 0.392 2016
## 117 13K553 Brooklyn Academy High School 0.640 2017
## 118 13K575 Bedford Stuyvesant Preparatory High School 0.556 2017
## 119 13K616 Brooklyn High School for Leadership and Community 0.294 2017
## 120 15K529 West Brooklyn Community High School 0.429 2017
## 121 15K698 South Brooklyn Community High School 0.171 2017
## 122 16K669 Research and Service High School 0.375 2017
## 123 17K489 W.E.B. Dubois Academic High School 0.300 2017
## 124 17K568 Brownsville Academy High School 0.625 2017
## 125 18K578 Brooklyn Bridge Academy 0.469 2017
## 126 18K635 Olympus Academy 0.333 2017
## 127 18K673 East Brooklyn Community High School 0.667 2017
## 128 21K728 Liberation Diploma Plus 0.486 2017
## 129 22K630 Professional Pathways High School 0.708 2017
## 130 23K643 Brooklyn Democracy Academy 0.410 2017
## 131 23K646 Aspirations Diploma Plus High School 0.353 2017
## 132 23K647 Metropolitan Diploma Plus High School 0.567 2017
## 139 32K564 Bushwick Community High School 0.329 2017
## 169 13K553 Brooklyn Academy High School 0.577 2018
## 170 13K575 Bedford Stuyvesant Preparatory High School 0.429 2018
## 171 13K616 Brooklyn High School for Leadership and Community 0.310 2018
## 172 15K423 Brooklyn Frontiers High School 0.333 2018
## 173 15K529 West Brooklyn Community High School 0.400 2018
## 174 15K698 South Brooklyn Community High School 0.344 2018
## 175 16K669 Research and Service High School 0.293 2018
## 176 17K489 W.E.B. Dubois Academic High School 0.429 2018
## 177 17K568 Brownsville Academy High School 0.565 2018
## 178 18K578 Brooklyn Bridge Academy 0.561 2018
## 179 18K635 Olympus Academy 0.500 2018
## 180 18K673 East Brooklyn Community High School 0.586 2018
## 181 21K728 Liberation Diploma Plus 0.436 2018
## 182 22K630 Professional Pathways High School 0.444 2018
## 183 23K643 Brooklyn Democracy Academy 0.472 2018
## 184 23K646 Aspirations Diploma Plus High School 0.477 2018
## 185 23K647 Metropolitan Diploma Plus High School 0.630 2018
## 192 32K564 Bushwick Community High School 0.493 2018
## 222 13K553 Brooklyn Academy High School 0.276 2019
## 223 13K616 Brooklyn High School for Leadership and Community 0.296 2019
## 224 15K423 Brooklyn Frontiers High School 0.444 2019
## 225 15K529 West Brooklyn Community High School 0.447 2019
## 226 15K698 South Brooklyn Community High School 0.436 2019
## 227 16K669 Research and Service High School 0.362 2019
## 228 17K568 Brownsville Academy High School 0.583 2019
## 229 17K646 Aspirations Diploma Plus High School 0.333 2019
## 230 18K578 Brooklyn Bridge Academy 0.364 2019
## 231 18K635 Olympus Academy 0.258 2019
## 232 18K673 East Brooklyn Community High School 0.627 2019
## 233 21K728 Liberation Diploma Plus 0.429 2019
## 234 22K630 Professional Pathways High School 0.548 2019
## 235 23K643 Brooklyn Democracy Academy 0.550 2019
## 236 23K647 Metropolitan Diploma Plus High School 0.767 2019
## 243 32K564 Bushwick Community High School 0.500 2019
# add a new column for Borough
brooklyn$Borough <- "Brooklyn"
# Use pattern matching to find schools in Manhattan and add a column Borough
sqr1519$Match3 <- grepl(pattern = "(^01M|02M|03M|04M|05M|06M)", sqr1519$DBN)
manhattan <- sqr1519[sqr1519$Match3 == TRUE,]
manhattan
## DBN School Grad_BHM Year
## 1 01M458 Forsyth Satellite Academy 0.408 2015
## 2 01M650 Cascades High School 0.700 2015
## 3 02M313 James Baldwin School, The: A School for Expedition 0.267 2015
## 4 02M394 EMMA LAZARUS HIGH SCHOOL 0.474 2015
## 5 02M544 Independence High School 0.217 2015
## 6 02M560 High School M560 - City As School 0.474 2015
## 7 02M570 Satellite Academy High School 0.688 2015
## 8 02M575 Manhattan Comprehensive Night and Day High School 0.413 2015
## 9 03M404 Innovation Diploma Plus 0.480 2015
## 10 03M505 Edward A. Reynolds West Side High School 0.518 2015
## 11 05M285 Harlem Renaissance High School 0.455 2015
## 43 01M458 Forsyth Satellite Academy 0.257 2016
## 44 01M515 Lower East Side Preparatory High School 0.632 2016
## 45 01M650 Cascades High School 0.448 2016
## 46 02M313 James Baldwin School, The: A School for Expedition 0.478 2016
## 47 02M544 Independence High School 0.257 2016
## 48 02M550 Liberty High School Academy for Newcomers 0.400 2016
## 49 02M560 High School M560 - City As School 0.543 2016
## 50 02M570 Satellite Academy High School 0.600 2016
## 51 02M575 Manhattan Comprehensive Night and Day High School 0.435 2016
## 52 03M404 Innovation Diploma Plus 0.500 2016
## 53 03M505 Edward A. Reynolds West Side High School 0.460 2016
## 54 05M285 Harlem Renaissance High School 0.488 2016
## 55 06M423 High School for Excellence and Innovation 0.750 2016
## 90 01M458 Forsyth Satellite Academy 0.375 2017
## 91 01M515 Lower East Side Preparatory High School 0.385 2017
## 92 01M650 Cascades High School 0.724 2017
## 93 02M313 James Baldwin School, The: A School for Expedition 0.385 2017
## 94 02M394 Emma Lazarus High School 0.200 2017
## 95 02M432 Murray Hill Academy 0.308 2017
## 96 02M544 Independence High School 0.323 2017
## 97 02M550 Liberty High School Academy for Newcomers 0.500 2017
## 98 02M560 High School M560 - City As School 0.381 2017
## 99 02M570 Satellite Academy High School 0.500 2017
## 100 02M575 Manhattan Comprehensive Night and Day High School 0.436 2017
## 101 02M586 Harvey Milk High School 0.667 2017
## 102 02M605 Humanities Preparatory Academy 0.625 2017
## 103 03M404 Innovation Diploma Plus 0.703 2017
## 104 03M505 Edward A. Reynolds West Side High School 0.443 2017
## 105 05M285 Harlem Renaissance High School 0.407 2017
## 106 06M423 High School for Excellence and Innovation 0.519 2017
## 145 01M458 Forsyth Satellite Academy 0.439 2018
## 146 01M515 Lower East Side Preparatory High School 0.344 2018
## 147 01M650 Cascades High School 0.600 2018
## 148 02M313 James Baldwin School, The: A School for Expedition 0.500 2018
## 149 02M544 Independence High School 0.418 2018
## 150 02M550 Liberty High School Academy for Newcomers 0.393 2018
## 151 02M560 High School M560 - City As School 0.500 2018
## 152 02M570 Satellite Academy High School 0.418 2018
## 153 02M575 Manhattan Comprehensive Night and Day High School 0.474 2018
## 154 02M586 Harvey Milk High School 0.300 2018
## 155 03M404 Innovation Diploma Plus 0.457 2018
## 156 03M505 Edward A. Reynolds West Side High School 0.391 2018
## 157 05M285 Harlem Renaissance High School 0.286 2018
## 158 06M423 High School for Excellence and Innovation 0.455 2018
## 198 01M458 Forsyth Satellite Academy 0.378 2019
## 199 01M515 Lower East Side Preparatory High School 0.444 2019
## 200 01M650 Cascades High School 0.361 2019
## 201 02M313 James Baldwin School, The: A School for Expedition 0.529 2019
## 202 02M394 Emma Lazarus High School 0.778 2019
## 203 02M544 Independence High School 0.339 2019
## 204 02M550 Liberty High School Academy for Newcomers 0.333 2019
## 205 02M560 High School M560 - City As School 0.435 2019
## 206 02M570 Satellite Academy High School 0.368 2019
## 207 02M575 Manhattan Comprehensive Night and Day High School 0.361 2019
## 208 02M586 Harvey Milk High School 0.300 2019
## 209 03M404 Innovation Diploma Plus 0.467 2019
## 210 03M505 Edward A. Reynolds West Side High School 0.280 2019
## 211 05M285 Harlem Renaissance High School 0.364 2019
## 212 06M423 High School for Excellence and Innovation 0.412 2019
## Match Match2 Match3
## 1 FALSE FALSE TRUE
## 2 FALSE FALSE TRUE
## 3 FALSE FALSE TRUE
## 4 FALSE FALSE TRUE
## 5 FALSE FALSE TRUE
## 6 FALSE FALSE TRUE
## 7 FALSE FALSE TRUE
## 8 FALSE FALSE TRUE
## 9 FALSE FALSE TRUE
## 10 FALSE FALSE TRUE
## 11 FALSE FALSE TRUE
## 43 FALSE FALSE TRUE
## 44 FALSE FALSE TRUE
## 45 FALSE FALSE TRUE
## 46 FALSE FALSE TRUE
## 47 FALSE FALSE TRUE
## 48 FALSE FALSE TRUE
## 49 FALSE FALSE TRUE
## 50 FALSE FALSE TRUE
## 51 FALSE FALSE TRUE
## 52 FALSE FALSE TRUE
## 53 FALSE FALSE TRUE
## 54 FALSE FALSE TRUE
## 55 FALSE FALSE TRUE
## 90 FALSE FALSE TRUE
## 91 FALSE FALSE TRUE
## 92 FALSE FALSE TRUE
## 93 FALSE FALSE TRUE
## 94 FALSE FALSE TRUE
## 95 FALSE FALSE TRUE
## 96 FALSE FALSE TRUE
## 97 FALSE FALSE TRUE
## 98 FALSE FALSE TRUE
## 99 FALSE FALSE TRUE
## 100 FALSE FALSE TRUE
## 101 FALSE FALSE TRUE
## 102 FALSE FALSE TRUE
## 103 FALSE FALSE TRUE
## 104 FALSE FALSE TRUE
## 105 FALSE FALSE TRUE
## 106 FALSE FALSE TRUE
## 145 FALSE FALSE TRUE
## 146 FALSE FALSE TRUE
## 147 FALSE FALSE TRUE
## 148 FALSE FALSE TRUE
## 149 FALSE FALSE TRUE
## 150 FALSE FALSE TRUE
## 151 FALSE FALSE TRUE
## 152 FALSE FALSE TRUE
## 153 FALSE FALSE TRUE
## 154 FALSE FALSE TRUE
## 155 FALSE FALSE TRUE
## 156 FALSE FALSE TRUE
## 157 FALSE FALSE TRUE
## 158 FALSE FALSE TRUE
## 198 FALSE FALSE TRUE
## 199 FALSE FALSE TRUE
## 200 FALSE FALSE TRUE
## 201 FALSE FALSE TRUE
## 202 FALSE FALSE TRUE
## 203 FALSE FALSE TRUE
## 204 FALSE FALSE TRUE
## 205 FALSE FALSE TRUE
## 206 FALSE FALSE TRUE
## 207 FALSE FALSE TRUE
## 208 FALSE FALSE TRUE
## 209 FALSE FALSE TRUE
## 210 FALSE FALSE TRUE
## 211 FALSE FALSE TRUE
## 212 FALSE FALSE TRUE
# remove the match columns
manhattan[, 5:7] <- NULL;
manhattan
## DBN School Grad_BHM Year
## 1 01M458 Forsyth Satellite Academy 0.408 2015
## 2 01M650 Cascades High School 0.700 2015
## 3 02M313 James Baldwin School, The: A School for Expedition 0.267 2015
## 4 02M394 EMMA LAZARUS HIGH SCHOOL 0.474 2015
## 5 02M544 Independence High School 0.217 2015
## 6 02M560 High School M560 - City As School 0.474 2015
## 7 02M570 Satellite Academy High School 0.688 2015
## 8 02M575 Manhattan Comprehensive Night and Day High School 0.413 2015
## 9 03M404 Innovation Diploma Plus 0.480 2015
## 10 03M505 Edward A. Reynolds West Side High School 0.518 2015
## 11 05M285 Harlem Renaissance High School 0.455 2015
## 43 01M458 Forsyth Satellite Academy 0.257 2016
## 44 01M515 Lower East Side Preparatory High School 0.632 2016
## 45 01M650 Cascades High School 0.448 2016
## 46 02M313 James Baldwin School, The: A School for Expedition 0.478 2016
## 47 02M544 Independence High School 0.257 2016
## 48 02M550 Liberty High School Academy for Newcomers 0.400 2016
## 49 02M560 High School M560 - City As School 0.543 2016
## 50 02M570 Satellite Academy High School 0.600 2016
## 51 02M575 Manhattan Comprehensive Night and Day High School 0.435 2016
## 52 03M404 Innovation Diploma Plus 0.500 2016
## 53 03M505 Edward A. Reynolds West Side High School 0.460 2016
## 54 05M285 Harlem Renaissance High School 0.488 2016
## 55 06M423 High School for Excellence and Innovation 0.750 2016
## 90 01M458 Forsyth Satellite Academy 0.375 2017
## 91 01M515 Lower East Side Preparatory High School 0.385 2017
## 92 01M650 Cascades High School 0.724 2017
## 93 02M313 James Baldwin School, The: A School for Expedition 0.385 2017
## 94 02M394 Emma Lazarus High School 0.200 2017
## 95 02M432 Murray Hill Academy 0.308 2017
## 96 02M544 Independence High School 0.323 2017
## 97 02M550 Liberty High School Academy for Newcomers 0.500 2017
## 98 02M560 High School M560 - City As School 0.381 2017
## 99 02M570 Satellite Academy High School 0.500 2017
## 100 02M575 Manhattan Comprehensive Night and Day High School 0.436 2017
## 101 02M586 Harvey Milk High School 0.667 2017
## 102 02M605 Humanities Preparatory Academy 0.625 2017
## 103 03M404 Innovation Diploma Plus 0.703 2017
## 104 03M505 Edward A. Reynolds West Side High School 0.443 2017
## 105 05M285 Harlem Renaissance High School 0.407 2017
## 106 06M423 High School for Excellence and Innovation 0.519 2017
## 145 01M458 Forsyth Satellite Academy 0.439 2018
## 146 01M515 Lower East Side Preparatory High School 0.344 2018
## 147 01M650 Cascades High School 0.600 2018
## 148 02M313 James Baldwin School, The: A School for Expedition 0.500 2018
## 149 02M544 Independence High School 0.418 2018
## 150 02M550 Liberty High School Academy for Newcomers 0.393 2018
## 151 02M560 High School M560 - City As School 0.500 2018
## 152 02M570 Satellite Academy High School 0.418 2018
## 153 02M575 Manhattan Comprehensive Night and Day High School 0.474 2018
## 154 02M586 Harvey Milk High School 0.300 2018
## 155 03M404 Innovation Diploma Plus 0.457 2018
## 156 03M505 Edward A. Reynolds West Side High School 0.391 2018
## 157 05M285 Harlem Renaissance High School 0.286 2018
## 158 06M423 High School for Excellence and Innovation 0.455 2018
## 198 01M458 Forsyth Satellite Academy 0.378 2019
## 199 01M515 Lower East Side Preparatory High School 0.444 2019
## 200 01M650 Cascades High School 0.361 2019
## 201 02M313 James Baldwin School, The: A School for Expedition 0.529 2019
## 202 02M394 Emma Lazarus High School 0.778 2019
## 203 02M544 Independence High School 0.339 2019
## 204 02M550 Liberty High School Academy for Newcomers 0.333 2019
## 205 02M560 High School M560 - City As School 0.435 2019
## 206 02M570 Satellite Academy High School 0.368 2019
## 207 02M575 Manhattan Comprehensive Night and Day High School 0.361 2019
## 208 02M586 Harvey Milk High School 0.300 2019
## 209 03M404 Innovation Diploma Plus 0.467 2019
## 210 03M505 Edward A. Reynolds West Side High School 0.280 2019
## 211 05M285 Harlem Renaissance High School 0.364 2019
## 212 06M423 High School for Excellence and Innovation 0.412 2019
# add a new column for Borough
manhattan$Borough <- "Manhattan"
# Use pattern matching to find schools in Queens and add a column Borough
sqr1519$Match4 <- grepl(pattern = "(^24Q|25Q|26Q|27Q|28Q|29Q|30Q)", sqr1519$DBN)
queens <- sqr1519[sqr1519$Match4 == TRUE,]
queens
## DBN School Grad_BHM Year Match
## 35 24Q744 VOYAGES Preparatory 0.298 2015 FALSE
## 36 25Q540 Queens Academy High School 0.382 2015 FALSE
## 37 25Q792 North Queens Community High School 0.469 2015 FALSE
## 38 28Q338 Queens Satellite High School for Opportunity 0.200 2015 FALSE
## 81 24Q744 VOYAGES Preparatory 0.390 2016 FALSE
## 82 25Q540 Queens Academy High School 0.339 2016 FALSE
## 83 25Q792 North Queens Community High School 0.619 2016 FALSE
## 84 27Q261 Voyages Prep - South Queens 0.550 2016 FALSE
## 85 28Q338 Queens Satellite High School for Opportunity 0.219 2016 FALSE
## 133 24Q744 VOYAGES Preparatory 0.537 2017 FALSE
## 134 25Q540 Queens Academy High School 0.304 2017 FALSE
## 135 25Q792 North Queens Community High School 0.545 2017 FALSE
## 136 27Q261 Voyages Prep - South Queens 0.568 2017 FALSE
## 137 28Q338 Queens Satellite High School for Opportunity 0.163 2017 FALSE
## 186 24Q744 VOYAGES Preparatory 0.415 2018 FALSE
## 187 25Q540 Queens Academy High School 0.297 2018 FALSE
## 188 25Q792 North Queens Community High School 0.483 2018 FALSE
## 189 27Q261 Voyages Prep - South Queens 0.591 2018 FALSE
## 190 28Q338 Queens Satellite High School for Opportunity 0.303 2018 FALSE
## 237 24Q744 VOYAGES Preparatory 0.378 2019 FALSE
## 238 25Q540 Queens Academy High School 0.345 2019 FALSE
## 239 25Q792 North Queens Community High School 0.393 2019 FALSE
## 240 27Q261 Voyages Prep - South Queens 0.543 2019 FALSE
## 241 28Q338 Queens Satellite High School for Opportunity 0.148 2019 FALSE
## Match2 Match3 Match4
## 35 FALSE FALSE TRUE
## 36 FALSE FALSE TRUE
## 37 FALSE FALSE TRUE
## 38 FALSE FALSE TRUE
## 81 FALSE FALSE TRUE
## 82 FALSE FALSE TRUE
## 83 FALSE FALSE TRUE
## 84 FALSE FALSE TRUE
## 85 FALSE FALSE TRUE
## 133 FALSE FALSE TRUE
## 134 FALSE FALSE TRUE
## 135 FALSE FALSE TRUE
## 136 FALSE FALSE TRUE
## 137 FALSE FALSE TRUE
## 186 FALSE FALSE TRUE
## 187 FALSE FALSE TRUE
## 188 FALSE FALSE TRUE
## 189 FALSE FALSE TRUE
## 190 FALSE FALSE TRUE
## 237 FALSE FALSE TRUE
## 238 FALSE FALSE TRUE
## 239 FALSE FALSE TRUE
## 240 FALSE FALSE TRUE
## 241 FALSE FALSE TRUE
# remove the match columns
queens[, 5:8] <- NULL;
queens
## DBN School Grad_BHM Year
## 35 24Q744 VOYAGES Preparatory 0.298 2015
## 36 25Q540 Queens Academy High School 0.382 2015
## 37 25Q792 North Queens Community High School 0.469 2015
## 38 28Q338 Queens Satellite High School for Opportunity 0.200 2015
## 81 24Q744 VOYAGES Preparatory 0.390 2016
## 82 25Q540 Queens Academy High School 0.339 2016
## 83 25Q792 North Queens Community High School 0.619 2016
## 84 27Q261 Voyages Prep - South Queens 0.550 2016
## 85 28Q338 Queens Satellite High School for Opportunity 0.219 2016
## 133 24Q744 VOYAGES Preparatory 0.537 2017
## 134 25Q540 Queens Academy High School 0.304 2017
## 135 25Q792 North Queens Community High School 0.545 2017
## 136 27Q261 Voyages Prep - South Queens 0.568 2017
## 137 28Q338 Queens Satellite High School for Opportunity 0.163 2017
## 186 24Q744 VOYAGES Preparatory 0.415 2018
## 187 25Q540 Queens Academy High School 0.297 2018
## 188 25Q792 North Queens Community High School 0.483 2018
## 189 27Q261 Voyages Prep - South Queens 0.591 2018
## 190 28Q338 Queens Satellite High School for Opportunity 0.303 2018
## 237 24Q744 VOYAGES Preparatory 0.378 2019
## 238 25Q540 Queens Academy High School 0.345 2019
## 239 25Q792 North Queens Community High School 0.393 2019
## 240 27Q261 Voyages Prep - South Queens 0.543 2019
## 241 28Q338 Queens Satellite High School for Opportunity 0.148 2019
# add a new column for Borough
queens$Borough <- "Queens"
# Use pattern matching to find schools in Staten Island and add a column Borough
sqr1519$Match5 <- grepl(pattern = "(^31R)", sqr1519$DBN)
statenisland <- sqr1519[sqr1519$Match5 == TRUE,]
statenisland
## DBN School Grad_BHM Year Match Match2 Match3 Match4 Match5
## 39 31R470 Concord High School 0.294 2015 FALSE FALSE FALSE FALSE TRUE
## 86 31R470 Concord High School 0.500 2016 FALSE FALSE FALSE FALSE TRUE
## 138 31R470 Concord High School 0.375 2017 FALSE FALSE FALSE FALSE TRUE
## 191 31R470 Concord High School 0.500 2018 FALSE FALSE FALSE FALSE TRUE
## 242 31R470 Concord High School 0.629 2019 FALSE FALSE FALSE FALSE TRUE
# remove the match columns
statenisland[, 5:9] <- NULL;
statenisland
## DBN School Grad_BHM Year
## 39 31R470 Concord High School 0.294 2015
## 86 31R470 Concord High School 0.500 2016
## 138 31R470 Concord High School 0.375 2017
## 191 31R470 Concord High School 0.500 2018
## 242 31R470 Concord High School 0.629 2019
# add a new column for Borough
statenisland$Borough <- "Staten Island"
# select variables and merge datasets
all <- sqr1519 %>%
select(DBN, School, Year, Grad_BHM) %>%
mutate(Borough = "All")
bronx1 <- bronx %>%
select(DBN, School, Year, Grad_BHM, Borough)
brooklyn1 <- brooklyn %>%
select(DBN, School, Year, Grad_BHM, Borough)
manhattan1 <- manhattan %>%
select(DBN, School, Year, Grad_BHM, Borough)
queens1 <- queens %>%
select(DBN, School, Year, Grad_BHM, Borough)
statenisland1 <- statenisland %>%
select(DBN, School, Year, Grad_BHM, Borough)
grad <- as.data.frame(rbind(bronx1, brooklyn1, manhattan1, queens1, statenisland1))
loc.labs <- c("Bronx" = "Bronx",
"Brooklyn" = "Brooklyn",
"Manhattan" = "Manhattan",
"Queens" = "Queens",
"Staten Island" = "Staten Island")
grad
## DBN School Year Grad_BHM
## 12 07X379 Jill Chaifetz Transfer High School 2015 0.364
## 13 07X381 Bronx Haven High School 2015 0.348
## 14 07X557 Mott Haven Community High School 2015 0.412
## 15 08X377 Bronx Community High School 2015 0.306
## 16 08X537 Bronx Arena High School 2015 0.167
## 17 10X319 Providing Urban Learners Success In Education High 2015 0.391
## 18 10X397 English Language Learners and International Suppor 2015 0.350
## 19 12X446 Arturo A. Schomburg Satellite Academy Bronx 2015 0.290
## 20 12X480 Bronx Regional High School 2015 0.387
## 56 07X379 Jill Chaifetz Transfer High School 2016 0.346
## 57 07X381 Bronx Haven High School 2016 0.471
## 58 07X557 Mott Haven Community High School 2016 0.500
## 59 08X377 Bronx Community High School 2016 0.406
## 60 08X537 Bronx Arena High School 2016 0.235
## 61 10X319 Providing Urban Learners Success In Education High 2016 0.298
## 62 10X397 English Language Learners and International Suppor 2016 0.222
## 63 12X321 Crotona Academy High School 2016 0.267
## 64 12X446 Arturo A. Schomburg Satellite Academy Bronx 2016 0.500
## 65 12X480 Bronx Regional High School 2016 0.265
## 107 07X379 Jill Chaifetz Transfer High School 2017 0.484
## 108 07X381 Bronx Haven High School 2017 0.636
## 109 07X557 Mott Haven Community High School 2017 0.593
## 110 08X377 Bronx Community High School 2017 0.361
## 111 08X537 Bronx Arena High School 2017 0.343
## 112 10X319 Providing Urban Learners Success In Education High 2017 0.262
## 113 10X397 English Language Learners and International Suppor 2017 0.414
## 114 12X321 Crotona Academy High School 2017 0.286
## 115 12X446 Arturo A. Schomburg Satellite Academy Bronx 2017 0.474
## 116 12X480 Bronx Regional High School 2017 0.276
## 159 07X379 Jill Chaifetz Transfer High School 2018 0.314
## 160 07X381 Bronx Haven High School 2018 0.486
## 161 07X557 Mott Haven Community High School 2018 0.468
## 162 08X377 Bronx Community High School 2018 0.438
## 163 08X537 Bronx Arena High School 2018 0.457
## 164 10X319 Providing Urban Learners Success In Education High 2018 0.250
## 165 10X397 English Language Learners and International Suppor 2018 0.537
## 166 12X321 Crotona Academy High School 2018 0.412
## 167 12X446 Arturo A. Schomburg Satellite Academy Bronx 2018 0.379
## 168 12X480 Bronx Regional High School 2018 0.281
## 213 07X379 Jill Chaifetz Transfer High School 2019 0.387
## 214 07X381 Bronx Haven High School 2019 0.357
## 215 07X557 Mott Haven Community High School 2019 0.615
## 216 08X377 Bronx Community High School 2019 0.800
## 217 08X537 Bronx Arena High School 2019 0.261
## 218 10X319 Providing Urban Learners Success In Education High 2019 0.250
## 219 10X397 English Language Learners and International Suppor 2019 0.314
## 220 12X446 Arturo A. Schomburg Satellite Academy Bronx 2019 0.346
## 221 12X480 Bronx Regional High School 2019 0.214
## 21 13K553 Brooklyn Academy High School 2015 0.606
## 22 13K575 Bedford Stuyvesant Preparatory High School 2015 0.375
## 23 13K616 Brooklyn High School for Leadership and Community 2015 0.310
## 24 15K529 West Brooklyn Community High School 2015 0.344
## 25 15K698 South Brooklyn Community High School 2015 0.458
## 26 17K489 W.E.B. Dubois Academic High School 2015 0.294
## 27 17K568 Brownsville Academy High School 2015 0.538
## 28 18K578 Brooklyn Bridge Academy 2015 0.455
## 29 18K635 Olympus Academy 2015 0.432
## 30 18K673 East Brooklyn Community High School 2015 0.594
## 31 21K728 Liberation Diploma Plus 2015 0.548
## 32 23K643 Brooklyn Democracy Academy 2015 0.433
## 33 23K646 Aspirations Diploma Plus High School 2015 0.358
## 34 23K647 Metropolitan Diploma Plus High School 2015 0.611
## 40 32K564 Bushwick Community High School 2015 0.203
## 66 13K553 Brooklyn Academy High School 2016 0.619
## 67 13K616 Brooklyn High School for Leadership and Community 2016 0.273
## 68 15K529 West Brooklyn Community High School 2016 0.324
## 69 15K698 South Brooklyn Community High School 2016 0.313
## 70 16K669 Research and Service High School 2016 0.357
## 71 17K489 W.E.B. Dubois Academic High School 2016 0.368
## 72 17K568 Brownsville Academy High School 2016 0.300
## 73 18K578 Brooklyn Bridge Academy 2016 0.531
## 74 18K635 Olympus Academy 2016 0.279
## 75 18K673 East Brooklyn Community High School 2016 0.538
## 76 21K728 Liberation Diploma Plus 2016 0.378
## 77 22K630 Professional Pathways High School 2016 0.563
## 78 23K643 Brooklyn Democracy Academy 2016 0.333
## 79 23K646 Aspirations Diploma Plus High School 2016 0.469
## 80 23K647 Metropolitan Diploma Plus High School 2016 0.543
## 87 32K564 Bushwick Community High School 2016 0.392
## 117 13K553 Brooklyn Academy High School 2017 0.640
## 118 13K575 Bedford Stuyvesant Preparatory High School 2017 0.556
## 119 13K616 Brooklyn High School for Leadership and Community 2017 0.294
## 120 15K529 West Brooklyn Community High School 2017 0.429
## 121 15K698 South Brooklyn Community High School 2017 0.171
## 122 16K669 Research and Service High School 2017 0.375
## 123 17K489 W.E.B. Dubois Academic High School 2017 0.300
## 124 17K568 Brownsville Academy High School 2017 0.625
## 125 18K578 Brooklyn Bridge Academy 2017 0.469
## 126 18K635 Olympus Academy 2017 0.333
## 127 18K673 East Brooklyn Community High School 2017 0.667
## 128 21K728 Liberation Diploma Plus 2017 0.486
## 129 22K630 Professional Pathways High School 2017 0.708
## 130 23K643 Brooklyn Democracy Academy 2017 0.410
## 131 23K646 Aspirations Diploma Plus High School 2017 0.353
## 132 23K647 Metropolitan Diploma Plus High School 2017 0.567
## 139 32K564 Bushwick Community High School 2017 0.329
## 169 13K553 Brooklyn Academy High School 2018 0.577
## 170 13K575 Bedford Stuyvesant Preparatory High School 2018 0.429
## 171 13K616 Brooklyn High School for Leadership and Community 2018 0.310
## 172 15K423 Brooklyn Frontiers High School 2018 0.333
## 173 15K529 West Brooklyn Community High School 2018 0.400
## 174 15K698 South Brooklyn Community High School 2018 0.344
## 175 16K669 Research and Service High School 2018 0.293
## 176 17K489 W.E.B. Dubois Academic High School 2018 0.429
## 177 17K568 Brownsville Academy High School 2018 0.565
## 178 18K578 Brooklyn Bridge Academy 2018 0.561
## 179 18K635 Olympus Academy 2018 0.500
## 180 18K673 East Brooklyn Community High School 2018 0.586
## 181 21K728 Liberation Diploma Plus 2018 0.436
## 182 22K630 Professional Pathways High School 2018 0.444
## 183 23K643 Brooklyn Democracy Academy 2018 0.472
## 184 23K646 Aspirations Diploma Plus High School 2018 0.477
## 185 23K647 Metropolitan Diploma Plus High School 2018 0.630
## 192 32K564 Bushwick Community High School 2018 0.493
## 222 13K553 Brooklyn Academy High School 2019 0.276
## 223 13K616 Brooklyn High School for Leadership and Community 2019 0.296
## 224 15K423 Brooklyn Frontiers High School 2019 0.444
## 225 15K529 West Brooklyn Community High School 2019 0.447
## 226 15K698 South Brooklyn Community High School 2019 0.436
## 227 16K669 Research and Service High School 2019 0.362
## 228 17K568 Brownsville Academy High School 2019 0.583
## 229 17K646 Aspirations Diploma Plus High School 2019 0.333
## 230 18K578 Brooklyn Bridge Academy 2019 0.364
## 231 18K635 Olympus Academy 2019 0.258
## 232 18K673 East Brooklyn Community High School 2019 0.627
## 233 21K728 Liberation Diploma Plus 2019 0.429
## 234 22K630 Professional Pathways High School 2019 0.548
## 235 23K643 Brooklyn Democracy Academy 2019 0.550
## 236 23K647 Metropolitan Diploma Plus High School 2019 0.767
## 243 32K564 Bushwick Community High School 2019 0.500
## 1 01M458 Forsyth Satellite Academy 2015 0.408
## 2 01M650 Cascades High School 2015 0.700
## 3 02M313 James Baldwin School, The: A School for Expedition 2015 0.267
## 4 02M394 EMMA LAZARUS HIGH SCHOOL 2015 0.474
## 5 02M544 Independence High School 2015 0.217
## 6 02M560 High School M560 - City As School 2015 0.474
## 7 02M570 Satellite Academy High School 2015 0.688
## 8 02M575 Manhattan Comprehensive Night and Day High School 2015 0.413
## 9 03M404 Innovation Diploma Plus 2015 0.480
## 10 03M505 Edward A. Reynolds West Side High School 2015 0.518
## 11 05M285 Harlem Renaissance High School 2015 0.455
## 43 01M458 Forsyth Satellite Academy 2016 0.257
## 44 01M515 Lower East Side Preparatory High School 2016 0.632
## 45 01M650 Cascades High School 2016 0.448
## 46 02M313 James Baldwin School, The: A School for Expedition 2016 0.478
## 47 02M544 Independence High School 2016 0.257
## 48 02M550 Liberty High School Academy for Newcomers 2016 0.400
## 49 02M560 High School M560 - City As School 2016 0.543
## 50 02M570 Satellite Academy High School 2016 0.600
## 51 02M575 Manhattan Comprehensive Night and Day High School 2016 0.435
## 52 03M404 Innovation Diploma Plus 2016 0.500
## 53 03M505 Edward A. Reynolds West Side High School 2016 0.460
## 54 05M285 Harlem Renaissance High School 2016 0.488
## 55 06M423 High School for Excellence and Innovation 2016 0.750
## 90 01M458 Forsyth Satellite Academy 2017 0.375
## 91 01M515 Lower East Side Preparatory High School 2017 0.385
## 92 01M650 Cascades High School 2017 0.724
## 93 02M313 James Baldwin School, The: A School for Expedition 2017 0.385
## 94 02M394 Emma Lazarus High School 2017 0.200
## 95 02M432 Murray Hill Academy 2017 0.308
## 96 02M544 Independence High School 2017 0.323
## 97 02M550 Liberty High School Academy for Newcomers 2017 0.500
## 98 02M560 High School M560 - City As School 2017 0.381
## 99 02M570 Satellite Academy High School 2017 0.500
## 100 02M575 Manhattan Comprehensive Night and Day High School 2017 0.436
## 101 02M586 Harvey Milk High School 2017 0.667
## 102 02M605 Humanities Preparatory Academy 2017 0.625
## 103 03M404 Innovation Diploma Plus 2017 0.703
## 104 03M505 Edward A. Reynolds West Side High School 2017 0.443
## 105 05M285 Harlem Renaissance High School 2017 0.407
## 106 06M423 High School for Excellence and Innovation 2017 0.519
## 145 01M458 Forsyth Satellite Academy 2018 0.439
## 146 01M515 Lower East Side Preparatory High School 2018 0.344
## 147 01M650 Cascades High School 2018 0.600
## 148 02M313 James Baldwin School, The: A School for Expedition 2018 0.500
## 149 02M544 Independence High School 2018 0.418
## 150 02M550 Liberty High School Academy for Newcomers 2018 0.393
## 151 02M560 High School M560 - City As School 2018 0.500
## 152 02M570 Satellite Academy High School 2018 0.418
## 153 02M575 Manhattan Comprehensive Night and Day High School 2018 0.474
## 154 02M586 Harvey Milk High School 2018 0.300
## 155 03M404 Innovation Diploma Plus 2018 0.457
## 156 03M505 Edward A. Reynolds West Side High School 2018 0.391
## 157 05M285 Harlem Renaissance High School 2018 0.286
## 158 06M423 High School for Excellence and Innovation 2018 0.455
## 198 01M458 Forsyth Satellite Academy 2019 0.378
## 199 01M515 Lower East Side Preparatory High School 2019 0.444
## 200 01M650 Cascades High School 2019 0.361
## 201 02M313 James Baldwin School, The: A School for Expedition 2019 0.529
## 202 02M394 Emma Lazarus High School 2019 0.778
## 203 02M544 Independence High School 2019 0.339
## 204 02M550 Liberty High School Academy for Newcomers 2019 0.333
## 205 02M560 High School M560 - City As School 2019 0.435
## 206 02M570 Satellite Academy High School 2019 0.368
## 207 02M575 Manhattan Comprehensive Night and Day High School 2019 0.361
## 208 02M586 Harvey Milk High School 2019 0.300
## 209 03M404 Innovation Diploma Plus 2019 0.467
## 210 03M505 Edward A. Reynolds West Side High School 2019 0.280
## 211 05M285 Harlem Renaissance High School 2019 0.364
## 212 06M423 High School for Excellence and Innovation 2019 0.412
## 35 24Q744 VOYAGES Preparatory 2015 0.298
## 36 25Q540 Queens Academy High School 2015 0.382
## 37 25Q792 North Queens Community High School 2015 0.469
## 38 28Q338 Queens Satellite High School for Opportunity 2015 0.200
## 81 24Q744 VOYAGES Preparatory 2016 0.390
## 82 25Q540 Queens Academy High School 2016 0.339
## 83 25Q792 North Queens Community High School 2016 0.619
## 84 27Q261 Voyages Prep - South Queens 2016 0.550
## 85 28Q338 Queens Satellite High School for Opportunity 2016 0.219
## 133 24Q744 VOYAGES Preparatory 2017 0.537
## 134 25Q540 Queens Academy High School 2017 0.304
## 135 25Q792 North Queens Community High School 2017 0.545
## 136 27Q261 Voyages Prep - South Queens 2017 0.568
## 137 28Q338 Queens Satellite High School for Opportunity 2017 0.163
## 186 24Q744 VOYAGES Preparatory 2018 0.415
## 187 25Q540 Queens Academy High School 2018 0.297
## 188 25Q792 North Queens Community High School 2018 0.483
## 189 27Q261 Voyages Prep - South Queens 2018 0.591
## 190 28Q338 Queens Satellite High School for Opportunity 2018 0.303
## 237 24Q744 VOYAGES Preparatory 2019 0.378
## 238 25Q540 Queens Academy High School 2019 0.345
## 239 25Q792 North Queens Community High School 2019 0.393
## 240 27Q261 Voyages Prep - South Queens 2019 0.543
## 241 28Q338 Queens Satellite High School for Opportunity 2019 0.148
## 39 31R470 Concord High School 2015 0.294
## 86 31R470 Concord High School 2016 0.500
## 138 31R470 Concord High School 2017 0.375
## 191 31R470 Concord High School 2018 0.500
## 242 31R470 Concord High School 2019 0.629
## Borough
## 12 Bronx
## 13 Bronx
## 14 Bronx
## 15 Bronx
## 16 Bronx
## 17 Bronx
## 18 Bronx
## 19 Bronx
## 20 Bronx
## 56 Bronx
## 57 Bronx
## 58 Bronx
## 59 Bronx
## 60 Bronx
## 61 Bronx
## 62 Bronx
## 63 Bronx
## 64 Bronx
## 65 Bronx
## 107 Bronx
## 108 Bronx
## 109 Bronx
## 110 Bronx
## 111 Bronx
## 112 Bronx
## 113 Bronx
## 114 Bronx
## 115 Bronx
## 116 Bronx
## 159 Bronx
## 160 Bronx
## 161 Bronx
## 162 Bronx
## 163 Bronx
## 164 Bronx
## 165 Bronx
## 166 Bronx
## 167 Bronx
## 168 Bronx
## 213 Bronx
## 214 Bronx
## 215 Bronx
## 216 Bronx
## 217 Bronx
## 218 Bronx
## 219 Bronx
## 220 Bronx
## 221 Bronx
## 21 Brooklyn
## 22 Brooklyn
## 23 Brooklyn
## 24 Brooklyn
## 25 Brooklyn
## 26 Brooklyn
## 27 Brooklyn
## 28 Brooklyn
## 29 Brooklyn
## 30 Brooklyn
## 31 Brooklyn
## 32 Brooklyn
## 33 Brooklyn
## 34 Brooklyn
## 40 Brooklyn
## 66 Brooklyn
## 67 Brooklyn
## 68 Brooklyn
## 69 Brooklyn
## 70 Brooklyn
## 71 Brooklyn
## 72 Brooklyn
## 73 Brooklyn
## 74 Brooklyn
## 75 Brooklyn
## 76 Brooklyn
## 77 Brooklyn
## 78 Brooklyn
## 79 Brooklyn
## 80 Brooklyn
## 87 Brooklyn
## 117 Brooklyn
## 118 Brooklyn
## 119 Brooklyn
## 120 Brooklyn
## 121 Brooklyn
## 122 Brooklyn
## 123 Brooklyn
## 124 Brooklyn
## 125 Brooklyn
## 126 Brooklyn
## 127 Brooklyn
## 128 Brooklyn
## 129 Brooklyn
## 130 Brooklyn
## 131 Brooklyn
## 132 Brooklyn
## 139 Brooklyn
## 169 Brooklyn
## 170 Brooklyn
## 171 Brooklyn
## 172 Brooklyn
## 173 Brooklyn
## 174 Brooklyn
## 175 Brooklyn
## 176 Brooklyn
## 177 Brooklyn
## 178 Brooklyn
## 179 Brooklyn
## 180 Brooklyn
## 181 Brooklyn
## 182 Brooklyn
## 183 Brooklyn
## 184 Brooklyn
## 185 Brooklyn
## 192 Brooklyn
## 222 Brooklyn
## 223 Brooklyn
## 224 Brooklyn
## 225 Brooklyn
## 226 Brooklyn
## 227 Brooklyn
## 228 Brooklyn
## 229 Brooklyn
## 230 Brooklyn
## 231 Brooklyn
## 232 Brooklyn
## 233 Brooklyn
## 234 Brooklyn
## 235 Brooklyn
## 236 Brooklyn
## 243 Brooklyn
## 1 Manhattan
## 2 Manhattan
## 3 Manhattan
## 4 Manhattan
## 5 Manhattan
## 6 Manhattan
## 7 Manhattan
## 8 Manhattan
## 9 Manhattan
## 10 Manhattan
## 11 Manhattan
## 43 Manhattan
## 44 Manhattan
## 45 Manhattan
## 46 Manhattan
## 47 Manhattan
## 48 Manhattan
## 49 Manhattan
## 50 Manhattan
## 51 Manhattan
## 52 Manhattan
## 53 Manhattan
## 54 Manhattan
## 55 Manhattan
## 90 Manhattan
## 91 Manhattan
## 92 Manhattan
## 93 Manhattan
## 94 Manhattan
## 95 Manhattan
## 96 Manhattan
## 97 Manhattan
## 98 Manhattan
## 99 Manhattan
## 100 Manhattan
## 101 Manhattan
## 102 Manhattan
## 103 Manhattan
## 104 Manhattan
## 105 Manhattan
## 106 Manhattan
## 145 Manhattan
## 146 Manhattan
## 147 Manhattan
## 148 Manhattan
## 149 Manhattan
## 150 Manhattan
## 151 Manhattan
## 152 Manhattan
## 153 Manhattan
## 154 Manhattan
## 155 Manhattan
## 156 Manhattan
## 157 Manhattan
## 158 Manhattan
## 198 Manhattan
## 199 Manhattan
## 200 Manhattan
## 201 Manhattan
## 202 Manhattan
## 203 Manhattan
## 204 Manhattan
## 205 Manhattan
## 206 Manhattan
## 207 Manhattan
## 208 Manhattan
## 209 Manhattan
## 210 Manhattan
## 211 Manhattan
## 212 Manhattan
## 35 Queens
## 36 Queens
## 37 Queens
## 38 Queens
## 81 Queens
## 82 Queens
## 83 Queens
## 84 Queens
## 85 Queens
## 133 Queens
## 134 Queens
## 135 Queens
## 136 Queens
## 137 Queens
## 186 Queens
## 187 Queens
## 188 Queens
## 189 Queens
## 190 Queens
## 237 Queens
## 238 Queens
## 239 Queens
## 240 Queens
## 241 Queens
## 39 Staten Island
## 86 Staten Island
## 138 Staten Island
## 191 Staten Island
## 242 Staten Island
grad %>%
ggplot(aes(x = Grad_BHM, y = factor(Year, levels = rev(unique(Year))), group(District), ordered = TRUE)) +
geom_density_ridges(alpha = 0.6, fill = "lightblue", scale = 1.5) +
scale_x_continuous(breaks = c(0.25, 0.50, 0.75), labels = scales::percent) +
scale_y_discrete(expand = c(0.01, 0)) +
theme_ridges()+
facet_wrap(~ Borough, labeller = labeller(Borough = loc.labs)) +
labs(x = "", y = NULL,
title = "Transfer High School Black/Hispanic Males Graduation Rate (2015-2019)",
caption = "Source: School Quality Report from NYC Open Data") +
theme(strip.background = element_blank(), title = element_text(),
plot.title = element_text(hjust = 0.5, size = 12, face = "bold"),
plot.caption= element_text(size=10),
strip.switch.pad.grid = unit(0.8, "in"))
## Picking joint bandwidth of 0.0561
## Picking joint bandwidth of 0.065
## Picking joint bandwidth of 0.0398
## Picking joint bandwidth of 0.0782
## Picking joint bandwidth of NaN
## Warning in FUN(X[[i]], ...): no non-missing arguments to max; returning -Inf
plot(ggplot(grad, aes(x = Grad_BHM, y = as.factor(Year), fill = Borough)) +
geom_density_ridges(alpha = 0.5, scale = 1) +
scale_x_continuous(breaks = c(0.25, 0.50, 0.75), labels = scales::percent) +
scale_y_discrete(expand = c(0.01, 0)) +
theme_ridges() +
labs(x = "", y = NULL,
title = "Transfer High School Black/Hispanic Males Graduation Rate (2015-2019)",
caption = "Source: School Quality Report from NYC Open Data") +
scale_fill_viridis_d(name = "Borough") +
theme(strip.background = element_blank(), title = element_text(),
plot.title = element_text(hjust = 0.5, size = 11, face = "bold"),
plot.caption= element_text(size=10),
strip.switch.pad.grid = unit(0.8, "in")))
## Picking joint bandwidth of 0.0598
Visualization 3: Reorder Bubble Plots
# load packages
library(readxl)
library(dplyr)
library(tidyverse)
library(rstatix)
library(ggplot2)
library(distill)
library(openxlsx)
# load data
ela <- openxlsx::read.xlsx("https://infohub.nyced.org/docs/default-source/default-document-library/district-ela-results-2013-2019-(public).xlsx", sheet = 4, na.strings=c("s"))
colnames(ela)
## [1] "District" "Grade" "Year" "Category"
## [5] "Number.Tested" "Mean.Scale.Score" "#.Level.1" "%.Level.1"
## [9] "#.Level.2" "%.Level.2" "#.Level.3" "%.Level.3"
## [13] "#.Level.4" "%.Level.4" "#.Level.3+4" "%.Level.3+4"
# check for missing values
missing <- ela[!complete.cases(ela),]
ela <- ela %>%
drop_na()
# rename columns
names(ela)[4:16] <- c("Race", "Number Tested", "Mean",
"L1", "L1Per", "L2", "L2Per", "L3", "L3Per",
"L4", "L4Per", "L34", "L34Per")
# plot the data
cbPalette <- c("#E69F00", "#0072B2", "#D55E00", "#56B4E9")
# Step 1: Calculate the median 'Mean' score for each district
district_order <- ela %>%
filter(Grade == "All Grades", Year == "2019") %>%
group_by(District) %>%
summarize(median_mean = median(Mean, na.rm = TRUE)) %>%
arrange(median_mean) %>%
pull(District)
# Step 2: Reorder the 'District' factor based on the median 'Mean' score
ela <- ela %>%
filter(Grade == "All Grades", Year == "2019") %>%
mutate(District = factor(District, levels = district_order))
ela
## District Grade Year Race Number Tested Mean L1 L1Per
## 1 1 All Grades 2019 Asian 929 615.7169 79 8.503768
## 2 1 All Grades 2019 Black 638 592.7304 210 32.915360
## 3 1 All Grades 2019 Hispanic 1656 596.7120 444 26.811594
## 4 1 All Grades 2019 White 726 619.0826 46 6.336088
## 5 2 All Grades 2019 Asian 4399 615.4731 274 6.228688
## 6 2 All Grades 2019 Black 1099 596.5732 324 29.481346
## 7 2 All Grades 2019 Hispanic 2488 603.8030 444 17.845659
## 8 2 All Grades 2019 White 6395 617.8622 242 3.784206
## 9 3 All Grades 2019 Asian 587 622.8637 21 3.577513
## 10 3 All Grades 2019 Black 1614 595.7955 473 29.306072
## 11 3 All Grades 2019 Hispanic 2370 599.2726 584 24.641350
## 12 3 All Grades 2019 White 2861 620.3737 96 3.355470
## 13 4 All Grades 2019 Asian 384 617.6823 34 8.854167
## 14 4 All Grades 2019 Black 1350 595.0385 437 32.370369
## 15 4 All Grades 2019 Hispanic 3164 595.9112 912 28.824272
## 16 4 All Grades 2019 White 212 614.7500 22 10.377358
## 17 5 All Grades 2019 Asian 99 602.4949 25 25.252525
## 18 5 All Grades 2019 Black 2166 590.6773 847 39.104340
## 19 5 All Grades 2019 Hispanic 1997 591.9289 737 36.905357
## 20 5 All Grades 2019 White 203 605.1330 54 26.600985
## 21 6 All Grades 2019 Asian 120 607.3750 21 17.500000
## 22 6 All Grades 2019 Black 480 594.7042 146 30.416666
## 23 6 All Grades 2019 Hispanic 7734 594.4806 2404 31.083527
## 24 6 All Grades 2019 White 549 612.6029 58 10.564663
## 25 7 All Grades 2019 Asian 73 592.9452 22 30.136986
## 26 7 All Grades 2019 Black 1895 591.2200 748 39.472294
## 27 7 All Grades 2019 Hispanic 4823 592.2839 1645 34.107403
## 28 7 All Grades 2019 White 105 590.4762 39 37.142857
## 29 8 All Grades 2019 Asian 781 606.8002 131 16.773367
## 30 8 All Grades 2019 Black 2545 591.3187 1003 39.410610
## 31 8 All Grades 2019 Hispanic 8225 593.4851 2838 34.504559
## 32 8 All Grades 2019 White 767 599.1956 183 23.859192
## 33 9 All Grades 2019 Asian 178 602.3203 37 20.786516
## 34 9 All Grades 2019 Black 4325 591.8167 1577 36.462429
## 35 9 All Grades 2019 Hispanic 10350 591.3906 3870 37.391304
## 36 9 All Grades 2019 White 192 590.9062 79 41.145832
## 37 10 All Grades 2019 Asian 1006 604.9016 178 17.693836
## 38 10 All Grades 2019 Black 3398 592.8843 1194 35.138317
## 39 10 All Grades 2019 Hispanic 17105 592.4241 6163 36.030399
## 40 10 All Grades 2019 White 964 603.1919 202 20.954357
## 41 11 All Grades 2019 Asian 1661 603.5665 331 19.927753
## 42 11 All Grades 2019 Black 7304 594.6312 2328 31.872946
## 43 11 All Grades 2019 Hispanic 7320 593.0257 2493 34.057377
## 44 11 All Grades 2019 White 1714 598.8442 429 25.029171
## 45 12 All Grades 2019 Asian 281 597.2028 70 24.911032
## 46 12 All Grades 2019 Black 2433 589.2199 1038 42.663380
## 47 12 All Grades 2019 Hispanic 6948 589.2353 2901 41.753021
## 48 12 All Grades 2019 White 153 586.6732 71 46.405228
## 49 13 All Grades 2019 Asian 265 604.8528 52 19.622641
## 50 13 All Grades 2019 Black 2634 597.1006 747 28.359909
## 51 13 All Grades 2019 Hispanic 982 597.0193 299 30.448065
## 52 13 All Grades 2019 White 712 614.2753 59 8.286517
## 53 14 All Grades 2019 Asian 246 608.7032 38 15.447154
## 54 14 All Grades 2019 Black 1185 594.0953 414 34.936710
## 55 14 All Grades 2019 Hispanic 3856 596.1235 1122 29.097511
## 56 14 All Grades 2019 White 999 611.8398 89 8.908909
## 57 15 All Grades 2019 Asian 2386 605.6995 384 16.093882
## 58 15 All Grades 2019 Black 920 599.3881 243 26.413044
## 59 15 All Grades 2019 Hispanic 5028 596.9156 1398 27.804296
## 60 15 All Grades 2019 White 4028 615.1530 234 5.809335
## 61 16 All Grades 2019 Asian 35 598.8286 9 25.714285
## 62 16 All Grades 2019 Black 1845 594.2732 633 34.308945
## 63 16 All Grades 2019 Hispanic 580 593.5328 203 35.000000
## 64 16 All Grades 2019 White 66 597.0303 22 33.333332
## 65 17 All Grades 2019 Asian 227 595.3172 81 35.682819
## 66 17 All Grades 2019 Black 6331 598.3041 1683 26.583479
## 67 17 All Grades 2019 Hispanic 1480 596.6865 401 27.094595
## 68 17 All Grades 2019 White 245 596.7510 76 31.020409
## 69 18 All Grades 2019 Asian 108 594.5278 31 28.703703
## 70 18 All Grades 2019 Black 5452 597.5114 1457 26.724138
## 71 18 All Grades 2019 Hispanic 445 594.6404 149 33.483147
## 72 18 All Grades 2019 White 195 590.3128 81 41.538460
## 73 19 All Grades 2019 Asian 739 602.2355 159 21.515562
## 74 19 All Grades 2019 Black 4342 590.0555 1760 40.534317
## 75 19 All Grades 2019 Hispanic 4629 592.3841 1665 35.968891
## 76 19 All Grades 2019 White 196 588.0255 78 39.795918
## 77 20 All Grades 2019 Asian 11181 609.4673 1436 12.843216
## 78 20 All Grades 2019 Black 430 603.3256 66 15.348837
## 79 20 All Grades 2019 Hispanic 5824 597.1164 1548 26.579670
## 80 20 All Grades 2019 White 5621 607.0959 868 15.442092
## 81 21 All Grades 2019 Asian 4332 609.9601 569 13.134810
## 82 21 All Grades 2019 Black 1140 593.1158 411 36.052631
## 83 21 All Grades 2019 Hispanic 3837 596.9622 1080 28.146990
## 84 21 All Grades 2019 White 5556 609.1434 760 13.678905
## 85 22 All Grades 2019 Asian 2650 606.5204 405 15.283019
## 86 22 All Grades 2019 Black 4921 596.7901 1372 27.880512
## 87 22 All Grades 2019 Hispanic 2328 596.7422 634 27.233677
## 88 22 All Grades 2019 White 4197 606.4825 620 14.772456
## 89 23 All Grades 2019 Asian 36 607.4722 4 11.111111
## 90 23 All Grades 2019 Black 3188 590.8708 1240 38.895859
## 91 23 All Grades 2019 Hispanic 1031 588.4675 467 45.295830
## 92 23 All Grades 2019 White 66 582.5303 34 51.515152
## 93 24 All Grades 2019 Asian 5355 610.9554 542 10.121382
## 94 24 All Grades 2019 Black 466 595.4464 136 29.184549
## 95 24 All Grades 2019 Hispanic 16976 595.2449 5121 30.166117
## 96 24 All Grades 2019 White 3588 607.3149 498 13.879599
## 97 25 All Grades 2019 Asian 8813 609.9110 1078 12.231930
## 98 25 All Grades 2019 Black 721 596.4092 199 27.600555
## 99 25 All Grades 2019 Hispanic 4157 599.4412 995 23.935530
## 100 25 All Grades 2019 White 2031 607.0483 288 14.180207
## 101 26 All Grades 2019 Asian 6890 615.6913 438 6.357039
## 102 26 All Grades 2019 Black 594 606.3047 74 12.457912
## 103 26 All Grades 2019 Hispanic 1532 605.3525 229 14.947781
## 104 26 All Grades 2019 White 1873 609.2969 206 10.998398
## 105 27 All Grades 2019 Asian 5070 606.2532 770 15.187377
## 106 27 All Grades 2019 Black 4532 593.3593 1601 35.326565
## 107 27 All Grades 2019 Hispanic 8238 597.2515 2292 27.822287
## 108 27 All Grades 2019 White 2139 605.9360 325 15.194016
## 109 28 All Grades 2019 Asian 4390 609.5647 566 12.892939
## 110 28 All Grades 2019 Black 3181 596.4643 941 29.581892
## 111 28 All Grades 2019 Hispanic 4065 596.6192 1179 29.003691
## 112 28 All Grades 2019 White 2442 606.5700 404 16.543816
## 113 29 All Grades 2019 Asian 2311 605.1861 359 15.534401
## 114 29 All Grades 2019 Black 8085 596.1008 2321 28.707483
## 115 29 All Grades 2019 Hispanic 2174 594.1863 694 31.922724
## 116 29 All Grades 2019 White 246 594.4349 74 30.081301
## 117 30 All Grades 2019 Asian 3889 613.1139 320 8.228336
## 118 30 All Grades 2019 Black 1098 594.2541 365 33.242260
## 119 30 All Grades 2019 Hispanic 9694 599.0351 2274 23.457809
## 120 30 All Grades 2019 White 2851 612.1863 291 10.206944
## 121 31 All Grades 2019 Asian 2762 611.2064 266 9.630702
## 122 31 All Grades 2019 Black 3238 592.3348 1206 37.245213
## 123 31 All Grades 2019 Hispanic 7685 596.8025 2196 28.575146
## 124 31 All Grades 2019 White 11855 607.9291 1475 12.442008
## 125 32 All Grades 2019 Asian 135 604.0963 28 20.740740
## 126 32 All Grades 2019 Black 875 597.3166 239 27.314285
## 127 32 All Grades 2019 Hispanic 4087 593.2653 1397 34.181553
## 128 32 All Grades 2019 White 126 600.4683 41 32.539684
## L2 L2Per L3 L3Per L4 L4Per L34 L34Per
## 1 128 13.778256 276 29.709366 446 48.008610 722 77.71798
## 2 242 37.931034 136 21.316614 50 7.836991 186 29.15360
## 3 579 34.963768 440 26.570047 193 11.654590 633 38.22464
## 4 81 11.157024 187 25.757576 412 56.749310 599 82.50689
## 5 634 14.412367 1477 33.575813 2014 45.783131 3491 79.35895
## 6 340 30.937216 292 26.569609 143 13.011829 435 39.58144
## 7 687 27.612539 782 31.430868 575 23.110933 1357 54.54180
## 8 760 11.884285 2236 34.964817 3157 49.366692 5393 84.33151
## 9 53 9.028961 147 25.042589 366 62.350937 513 87.39352
## 10 538 33.333332 398 24.659231 205 12.701363 603 37.36060
## 11 710 29.957806 681 28.734177 395 16.666666 1076 45.40084
## 12 281 9.821741 883 30.863335 1601 55.959454 2484 86.82279
## 13 48 12.500000 91 23.697916 211 54.947918 302 78.64584
## 14 431 31.925926 316 23.407408 166 12.296296 482 35.70370
## 15 1086 34.323643 781 24.683945 385 12.168141 1166 36.85209
## 16 32 15.094339 52 24.528301 106 50.000000 158 74.52831
## 17 21 21.212122 23 23.232323 30 30.303030 53 53.53535
## 18 739 34.118191 420 19.390581 160 7.386889 580 26.77747
## 19 633 31.697546 437 21.882824 190 9.514272 627 31.39709
## 20 37 18.226601 37 18.226601 75 36.945812 112 55.17241
## 21 22 18.333334 39 32.500000 38 31.666666 77 64.16666
## 22 165 34.375000 125 26.041666 44 9.166667 169 35.20833
## 23 2492 32.221359 2039 26.364107 799 10.331006 2838 36.69511
## 24 92 16.757742 184 33.515484 215 39.162113 399 72.67760
## 25 24 32.876713 19 26.027397 8 10.958904 27 36.98630
## 26 581 30.659630 421 22.216358 145 7.651715 566 29.86807
## 27 1694 35.123367 1126 23.346464 358 7.422766 1484 30.76923
## 28 37 35.238094 18 17.142857 11 10.476191 29 27.61905
## 29 166 21.254801 249 31.882202 235 30.089628 484 61.97183
## 30 783 30.766209 530 20.825148 229 8.998035 759 29.82318
## 31 2564 31.173252 1980 24.072948 843 10.249240 2823 34.32219
## 32 229 29.856585 221 28.813559 134 17.470665 355 46.28423
## 33 56 31.460674 45 25.280899 40 22.471910 85 47.75281
## 34 1471 34.011562 950 21.965319 327 7.560694 1277 29.52601
## 35 3354 32.405796 2306 22.280193 820 7.922705 3126 30.20290
## 36 53 27.604166 35 18.229166 25 13.020833 60 31.25000
## 37 248 24.652088 315 31.312128 265 26.341948 580 57.65408
## 38 1125 33.107712 789 23.219542 290 8.534432 1079 31.75397
## 39 5492 32.107571 3849 22.502192 1601 9.359837 5450 31.86203
## 40 224 23.236515 307 31.846474 231 23.962656 538 55.80913
## 41 399 24.021673 501 30.162552 430 25.888020 931 56.05057
## 42 2434 33.324207 1793 24.548193 749 10.254655 2542 34.80285
## 43 2416 33.005463 1685 23.019125 726 9.918033 2411 32.93716
## 44 485 28.296383 502 29.288216 298 17.386230 800 46.67445
## 45 90 32.028469 77 27.402136 44 15.658363 121 43.06050
## 46 795 32.675709 443 18.207973 157 6.452939 600 24.66091
## 47 2288 32.930340 1322 19.027058 437 6.289580 1759 25.31664
## 48 45 29.411764 27 17.647058 10 6.535948 37 24.18301
## 49 62 23.396227 75 28.301888 76 28.679245 151 56.98113
## 50 817 31.017464 736 27.942293 334 12.680334 1070 40.62263
## 51 290 29.531569 257 26.171080 136 13.849287 393 40.02037
## 52 91 12.780899 284 39.887642 278 39.044945 562 78.93259
## 53 47 19.105692 67 27.235773 94 38.211384 161 65.44715
## 54 346 29.198313 305 25.738396 120 10.126582 425 35.86498
## 55 1290 33.454357 996 25.829876 448 11.618258 1444 37.44813
## 56 170 17.017017 382 38.238239 358 35.835834 740 74.07407
## 57 555 23.260687 825 34.576698 622 26.068735 1447 60.64543
## 58 240 26.086956 261 28.369566 176 19.130434 437 47.50000
## 59 1644 32.696896 1354 26.929197 632 12.569611 1986 39.49881
## 60 569 14.126117 1479 36.717976 1746 43.346573 3225 80.06454
## 61 12 34.285713 8 22.857143 6 17.142857 14 40.00000
## 62 577 31.273712 459 24.878048 176 9.539295 635 34.41734
## 63 177 30.517241 155 26.724138 45 7.758621 200 34.48276
## 64 15 22.727272 19 28.787878 10 15.151515 29 43.93939
## 65 52 22.907490 45 19.823788 49 21.585903 94 41.40969
## 66 1953 30.848207 1720 27.167904 975 15.400411 2695 42.56831
## 67 475 32.094593 426 28.783783 178 12.027027 604 40.81081
## 68 63 25.714285 68 27.755102 38 15.510204 106 43.26530
## 69 37 34.259258 24 22.222221 16 14.814815 40 37.03704
## 70 1776 32.575203 1520 27.879677 699 12.820983 2219 40.70066
## 71 141 31.685392 111 24.943821 44 9.887640 155 34.83146
## 72 60 30.769230 36 18.461538 18 9.230769 54 27.69231
## 73 192 25.981056 228 30.852503 160 21.650879 388 52.50338
## 74 1435 33.049286 849 19.553202 298 6.863197 1147 26.41640
## 75 1487 32.123569 1067 23.050335 410 8.857204 1477 31.90754
## 76 61 31.122450 39 19.897959 18 9.183674 57 29.08163
## 77 2206 19.729898 3598 32.179592 3941 35.247295 7539 67.42689
## 78 135 31.395349 137 31.860466 92 21.395349 229 53.25581
## 79 1903 32.675137 1655 28.416895 718 12.328297 2373 40.74519
## 80 1250 22.238035 1850 32.912292 1653 29.407579 3503 62.31987
## 81 868 20.036934 1296 29.916897 1599 36.911358 2895 66.82825
## 82 390 34.210526 212 18.596491 127 11.140351 339 29.73684
## 83 1228 32.004169 1025 26.713579 504 13.135262 1529 39.84884
## 84 1140 20.518358 1677 30.183586 1979 35.619152 3656 65.80273
## 85 625 23.584906 847 31.962265 773 29.169811 1620 61.13208
## 86 1649 33.509449 1307 26.559643 593 12.050396 1900 38.61004
## 87 786 33.762886 621 26.675259 287 12.328178 908 39.00344
## 88 1015 24.183941 1457 34.715271 1105 26.328329 2562 61.04360
## 89 10 27.777779 11 30.555555 11 30.555555 22 61.11111
## 90 1079 33.845673 626 19.636135 243 7.622334 869 27.25847
## 91 317 30.746847 186 18.040737 61 5.916586 247 23.95732
## 92 22 33.333332 6 9.090909 4 6.060606 10 15.15152
## 93 1041 19.439775 1869 34.901962 1903 35.536880 3772 70.43884
## 94 166 35.622318 115 24.678112 49 10.515021 164 35.19313
## 95 5682 33.470783 4405 25.948399 1768 10.414703 6173 36.36310
## 96 866 24.136009 1197 33.361202 1027 28.623188 2224 61.98439
## 97 1714 19.448542 2925 33.189606 3096 35.129921 6021 68.31953
## 98 235 32.593620 200 27.739250 87 12.066574 287 39.80582
## 99 1240 29.829205 1254 30.165985 668 16.069281 1922 46.23527
## 100 497 24.470705 669 32.939438 577 28.409651 1246 61.34909
## 101 1041 15.108853 2183 31.683599 3228 46.850510 5411 78.53411
## 102 150 25.252525 213 35.858585 157 26.430977 370 62.28956
## 103 395 25.783289 523 34.138382 385 25.130548 908 59.26893
## 104 433 23.117992 633 33.796051 601 32.087559 1234 65.88361
## 105 1245 24.556213 1662 32.781067 1393 27.475346 3055 60.25641
## 106 1454 32.082966 1008 22.241837 469 10.348632 1477 32.59047
## 107 2565 31.136198 2275 27.615927 1106 13.425589 3381 41.04152
## 108 526 24.590931 709 33.146332 579 27.068724 1288 60.21505
## 109 940 21.412300 1386 31.571754 1498 34.123009 2884 65.69476
## 110 1020 32.065388 789 24.803520 431 13.549198 1220 38.35272
## 111 1272 31.291513 1076 26.469864 538 13.234932 1614 39.70480
## 112 604 24.733826 731 29.934481 703 28.787878 1434 58.72236
## 113 611 26.438770 777 33.621807 564 24.405020 1341 58.02683
## 114 2736 33.840446 2154 26.641930 874 10.810143 3028 37.45207
## 115 707 32.520699 544 25.022999 229 10.533579 773 35.55658
## 116 79 32.113823 64 26.016260 29 11.788618 93 37.80488
## 117 714 18.359476 1263 32.476215 1592 40.935974 2855 73.41219
## 118 336 30.601093 274 24.954462 123 11.202186 397 36.15665
## 119 3151 32.504642 2758 28.450588 1511 15.586961 4269 44.03755
## 120 540 18.940723 915 32.094002 1105 38.758331 2020 70.85233
## 121 565 20.456192 933 33.779869 998 36.133236 1931 69.91311
## 122 1011 31.222977 712 21.988882 309 9.542928 1021 31.53181
## 123 2466 32.088486 2043 26.584255 980 12.752114 3023 39.33637
## 124 2899 24.453817 4031 34.002529 3450 29.101645 7481 63.10418
## 125 25 18.518518 43 31.851852 39 28.888889 82 60.74074
## 126 283 32.342857 215 24.571428 138 15.771428 353 40.34286
## 127 1345 32.909225 930 22.755077 415 10.154147 1345 32.90923
## 128 20 15.873015 29 23.015873 36 28.571428 65 51.58730
# Step 3: Create the bubble plot
plot(ela %>%
ggplot(aes(x = District,
y = Mean,
size = `Number Tested`,
fill = Race)) +
scale_fill_manual(values = cbPalette) +
geom_line(aes(group = District), size = .2) +
geom_point(shape = 21, alpha = .7) +
theme(legend.key.height = unit(1, 'cm'), legend.key.width = unit(1, 'cm')) +
labs(x = "District", y = "Mean ELA Scale Score",
title = "Grades 3-8 ELA Results AY 2018-2019") +
theme(plot.title = element_text(size = 5)) +
coord_flip() +
theme_bw())
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.