Created
May 9, 2015 04:46
-
-
Save dfeng/46af2ca1b7421a709582 to your computer and use it in GitHub Desktop.
roster + grades -> ug + gs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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