Tuesday, August 12, 2014

R excel: match student language placement

For advising

require(xlsx)
list.files()

lang = read.xlsx2( "language Placement Results 2014Fall.xlsx", 1,
                  colClasses=c("character", "character", "character", "character", "character") )
for(i in 1:5) {
  lang[,i] = as.character(lang[,i])
}

tb = read.xlsx2( "qin-FYE-2014-worksheets.xlsx", 1 )
for(i in 1:4) {
  tb[,i] = as.character(tb[,i])
}

tb$SCID %in% lang$SCID
tb$Language = lang$Language[match(tb$SCID, lang$SCID)]
tb$placement = lang$placement[match(tb$SCID, lang$SCID)]

No comments:

Post a Comment