Skip to content

Instantly share code, notes, and snippets.

@dfeng
Created May 9, 2015 04:46
Show Gist options
  • Select an option

  • Save dfeng/46af2ca1b7421a709582 to your computer and use it in GitHub Desktop.

Select an option

Save dfeng/46af2ca1b7421a709582 to your computer and use it in GitHub Desktop.
roster + grades -> ug + gs
# Start R Grading Helper
# ==========================
# === Global Variables ===
# ==========================
folder <- "/Users/dfeng/Downloads/Grading"
roster_filename <- "ml_roster.csv"
grade_filename <- "ml_hw.csv"
# ===========================
# === Do Not Edit Below ===
# ===========================
setwd(folder)
# READ CSV
codes <- read.csv(roster_filename)
grades <- read.csv(grade_filename)
names(codes)[grep("User.ID",names(codes))] <- "Student.ID"
# MERGE BY ID
x <- merge(codes, grades, by="Student.ID")
# REMOVE NON-students
x <- subset(x, Role == "student")
# WRITING
gs <- subset(x, College.School == "GS" | College.School == "PH")
ug <- subset(x, College.School != "GS" & College.School != "PH")
write.csv(ug, "ug.csv")
write.csv(gs, "gs.csv")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment