The kysrc
package is a collection of data from the Kentucky Department of Education's School Report Card website. Instead of downloading Excel files for each year and category of school report card data from the state's website, analysts can simply load the kysrc
package and start exploring data from the 2011-12 school year to the 2015-16 school year.
kysrc
lowers the barriers to analyzing Kentucky School Report Card data. After one filter()
command, data for the 2015-17 school year is ready to plot from the profile_sch
dataset, which includes student enrollment information. The plot below illustrates the distribution of student body size among Kentucky's public schools.
library(tidyverse) library(kysrc) library(scales) profile_sch %>% filter(year == "2016-2017") %>% ggplot(aes(x = enroll)) + geom_histogram(binwidth = 200) + labs(x = "Enrollment", y = "# of KY Public Schools") + ggtitle("Kentucky Public School Enrollment, 2016-17") + theme_minimal()
Examining variables over time is very easy with kysrc
. In the example below, the ccr_state
dataset is used to plot the ccr_rate
over five school years (year
). All it takes is a quick filter
to select the desired student group (this plot uses "All Students") and it's ready to be fed into ggplot
.
ccr_state %>% filter(student_group == "All Students") %>% ggplot(aes(x = year, y = ccr_pct, group = sch_id)) + geom_line() + labs(x = "School Year", y = "College & Career Readiness Rate") + ggtitle("College & Career Readiness in Kentucky, 2011-12 to 2016-17") + scale_y_continuous(labels = percent) + theme_minimal()
It's also easy to join datasets to work with different kinds of variables. After filtering by year
on three different datasets and using select
to keep only the columns needed for analysis, they can be joined using the sch_id
variable. The result is a plot that looks at grad_rate
(4-year cohort graduation rate) by frpl_pct
(indicator of student poverty) and enroll
(school enrollment level).
# get data from 2016-17 school year grad16 <- grad_sch %>% filter(year == "2016-2017", student_group == "All Students") %>% select(sch_id, grad_rate) frpl16 <- frpl_sch %>% filter(year == "2016-2017") %>% select(sch_id, frpl_pct) profile16 <- profile_sch %>% filter(year == "2016-2017") %>% select(sch_id, enroll) # join and plot data grad16 %>% left_join(frpl16, by = "sch_id") %>% left_join(profile16, by = "sch_id") %>% ggplot(aes(x = frpl_pct, y = grad_rate, size = enroll)) + geom_point(alpha = .5) + scale_size_area(max_size = 10) + scale_x_continuous(label = percent) + scale_y_continuous(label = percent) + labs(x = "School FRPL Rate", y = "4-Year Cohort Graduation Rate", size = "Enrollment")+ ggtitle("School FRPL Rates vs. 4-Year Cohort Graduation Rates, 2016-17") + theme_minimal()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.