Skip to content

Instantly share code, notes, and snippets.

@mikelove
Last active December 14, 2017 14:30
Show Gist options
  • Save mikelove/387eae2becdd6d5f518e7f71f86bd745 to your computer and use it in GitHub Desktop.
Save mikelove/387eae2becdd6d5f518e7f71f86bd745 to your computer and use it in GitHub Desktop.
Script to automate pushing scores to student repos
x <- read.csv("grading - Sheet1.csv", stringsAsFactors=FALSE)
repo <- paste0("homework-",x$github)
for (i in seq_along(repo)) {
#system(paste0("git clone [email protected]:biodatascience/",repo[i],".git"))
setwd(repo[i])
system("git pull")
setwd("..")
}
hw <- "HW1"
cols <- x[,grep(hw,names(x))]
for (i in seq_along(repo)) {
setwd(repo[i])
out <- c(hw, as.character(cols[i,]))
write(out, file="scores.txt", append=TRUE, ncolumns=length(out), sep="\t")
system("git add scores.txt")
system(paste0("git commit -am 'adding ", hw," scores/comments'"))
system("git push")
setwd("..")
}
hw <- grep("comments",grep("HW",names(x),value=TRUE),value=TRUE,invert=TRUE)
# final grades:
hws <- x[,hw]
hws <- as.matrix(hws)
rownames(hws) <- x$onyen
colnames(hws)
hw.fac <- factor(substr(colnames(hws),1,3))
hws.sum <- t(rowsum(t(hws), hw.fac))
hws.norm <- sweep(hws.sum, 2, tapply(rep(2,24),hw.fac,sum), "/")
hws.final <- apply(hws.norm, 1, function(z) sum(z[-which.min(z)]))
hist(hws.final/7)
mt <- x[,c(paste0("MT1.",1:5))]
rownames(mt) <- x$onyen
mt.final <- rowSums(mt)
hist(mt.final/10)
weight <- c(hw=.45, mt=.15, f=.4)
final <- final.unsorted[names(hws.final)]
total <- weight[1]*hws.final/7 + weight[2]*mt.final/10 + weight[3]*final/10
sort(total)
total[total > .98]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment