Wednesday, August 12, 2015

R code: find student pins, placement results for advising

rm(list=ls())
require(xlsx)
setwd("~/Dropbox/courses.student.research.dp/FYE_and_advising/FYEFall2015/match_placement")
list.files()

tb = read.xlsx2( "FYE_advisee20150812.xlsx", 1 )
for(i in 1:6) {
  tb[,i] = as.character(tb[,i]) 
}

lang = read.xlsx2( "World Languages 2015 Placement.xlsx", 1, 
                   colClasses=c("character", "character", "character", "character", "character") )
for(i in 1:5) {
  lang[,i] = as.character(lang[,i]) 
}

tb$ID %in% lang$ID
tb$language = lang$language[match(tb$ID, lang$ID)]
tb$langLevel = lang$level[match(tb$ID, lang$ID)]


pins = read.xlsx("qin-registration-pins20150812.xlsx", 1)
for(i in 1:4) {
  pins[,i] = as.character(pins[,i]) 
}
tb$pin = pins$Alternate.PIN[match(tb$ID, pins$ID)]


math = read.xlsx2(  "math Advisor Placements Fall 2015.xlsx", 1)
for(i in 1:6) {
  math[,i] = as.character(math[,i]) 
}
tb$ID %in% math$Student.ID
tb$MathCode = math$CODE[match(tb$ID, math$Student.ID)]
tb$MathPlacement = math[match(tb$ID, math$Student.ID), 5]
tb$MathOther = math[match(tb$ID, math$Student.ID), 6]

str(tb)

write.xlsx(tb, "qin-FYE-placement_and_pins_20150812.xlsx")

No comments:

Post a Comment