Skip to content

Instantly share code, notes, and snippets.

View chrishaid's full-sized avatar

Chris Haid chrishaid

View GitHub Profile
@chrishaid
chrishaid / satellite_viz_anova.R
Created May 28, 2021 15:08
Basic code for creating a satellite diagram (aka visual ANOVA)
# School and regional data (% of students earning 2+ on Mock AP exams)
schools_plot_df %>%
ggplot(aes(y=region, x = pct_2plus)) +
# plot the schools adn regions first
geom_point(aes(size = n_stus,
color = str_detect(school, "Average")), #Name of region = "Region Name Average" is in school field
show.legend = FALSE,
alpha = 0.75 #lighten up the points so we can see overlaps better
) +
@chrishaid
chrishaid / remote_vs_inperson_semester_exams.R
Created January 15, 2021 23:37
Calculating learning environments
# 30 day averages for Semester exams ----
remote_vs_inperson_semester_exams <- att_students %>%
ungroup() %>%
select(student_number,school_number, grade_level_id, enrollment_status, att_date, att_code) %>%
# one-hot encode attendance tupe
mutate(in_person = as.integer(att_code=="present-in-person"),
remote = as.integer(att_code=="present-remote"),
absent = as.integer(att_code=="absent")) %>%
group_by(student_number, school_number, grade_level_id, enrollment_status) %>%
@chrishaid
chrishaid / attendance.R
Last active May 22, 2020 19:29
KIPP Chicago attendance approach
library(tidyverse) # tidyvese
library(silounloadr) # KIPP Chicago data acess package
library(lubridate) # data stuff
library(janitor) # munging stuff
lirbrary(googlesheets4) # for tossing the data into a Google Sheet
# Need to get get the 2 digit PowerSchool Year id (2019-2020 = 29)
# this function returns the 4 digit year id (2019-2020 = 2900) and divides by 100 to get 2 digit
ps_yearid_4_years_ago <- silounloadr::calc_ps_termid(2019-3)/100
@chrishaid
chrishaid / color_ggplot_background.R
Last active July 14, 2017 15:50
Color background for reference in ggplot2 (check out the ggplot2 call itself)
# This might be a bit much and requried a coord switch
cutpoints <- tribble(
~Level, ~low, ~high, ~x,
"3", 1, 2, 0,
"2", 2, 3, 0,
"2+", 3, 3.5, 0,
"1", 3.5, 4, 0,
"1+", 4, 5, 0,
"3", 1, 2, 1,
"2", 2, 3, 1,
@chrishaid
chrishaid / ttm.R
Created May 6, 2016 03:16
Logging into Think Through Math in R
require(rvest)
require(httr)
# user login url
url <- 'https://lms.thinkthroughmath.com'
# makes TTM think were are a current flavor of Chrome
uastring<-"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
# This is safari if you want ot take that for a spin
# Load packages
require(googlesheets)
require(dplyr)
require(igraph)
require(ggraph)
# get spreadsheet
x <- gs_title("Data Whiz Tool Tracker Sheet")
@chrishaid
chrishaid / keybase.md
Created June 11, 2015 03:32
Keybase proof for chrishaid

Keybase proof

I hereby claim:

  • I am chrishaid on github.
  • I am chrishaid (https://keybase.io/chrishaid) on keybase.
  • I have a public key whose fingerprint is A169 B34E 9444 8A37 2B16 0304 BE9C 2098 5129 9A7C

To claim this, I am signing this object:

@chrishaid
chrishaid / get_CDF.py
Created June 12, 2013 16:36
Python script to automate retrieval and unzipping of NWEA MAP CDF from the pdx_map01.mapnwea.org website.
"""
Python Script to pull CDF zip file from NWEA's MAP reporting site
Need to authenticate to NWEA, then navigate to export page and save file with a an appropriate name
"""
import mechanize
import cookielib
import shutil
import os
import zipfile
@chrishaid
chrishaid / PowerSchool_Daily_Student_Attendance.sql
Created April 22, 2013 20:12
This SQL query pulls daily student attendance for each student enrolled on each day for the date range given.
SELECT
m.schoolid,
m.grade_level,
m.calendardate,
m.STUDENT_NUMBER AS StudentID,
m.lastfirst,
m.Enrolled,
a.Att_Code,
a.Description as AttDescr,
a.Presence_Status_CD,
@chrishaid
chrishaid / Kickboard_long_to_2_row_wide.R
Created December 7, 2012 18:39
Kickboard long to wide (2 row per student) format for R
####################################################################################
## Script to transform
## Long format Kicboard culture csv
## to wide format (by behavoir event), where
## each student is represented by 2(!) rows
## One row for negative paycheck events (i.e., deductions)
## and the other row for postive (though value 0) culture events (Create Points)
#################################################################################
#Load Libraries