3 gs <- read.delim("student_information.tsv")
 
   5 colnames(d) <- c("student.num", "discord.name")
 
   7 call.list <- do.call("rbind", lapply(list.files(".", pattern="^call_list-.*tsv$"), function (x) {read.delim(x)[,1:3]}))
 
   8 colnames(call.list) <- gsub("_", ".", colnames(call.list))
 
  10 call.counts <- data.frame(table(call.list$discord.name))
 
  11 colnames(call.counts) <- c("discord.name", "num.calls")
 
  13 d <- merge(d, call.counts, all.x=TRUE, all.y=TRUE, by="discord.name"); d
 
  15 ## set anything that's missing to zero
 
  16 d$num.calls[is.na(d$num.calls)] <- 0
 
  18 attendance <- unlist(lapply(list.files(".", pattern="^attendance-.*tsv$"), function (x) {d <- read.delim(x); strsplit(d[[2]], ",")}))
 
  20 attendance.counts <- data.frame(table(attendance))
 
  21 colnames(attendance.counts) <- c("discord.name", "num.present")
 
  23 d <- merge(d, attendance.counts, all.x=TRUE, all.y=TRUE, by="discord.name"); d
 
  26 color.gradient <- scales::seq_gradient_pal("yellow", "magenta", "Lab")(seq(0,1,length.out=length(unique(d$num.present))))
 
  28 png("questions_absence_histogram_combined.png", units="px", width=800, height=600)
 
  31     aes(x=as.factor(num.calls), fill=as.factor(num.present)) +
 
  32     geom_bar(color="black") +
 
  34     scale_x_discrete("Number of questions asked") +
 
  35     scale_y_continuous("Number of students") +
 
  36     # scale_fill_brewer("Absences") +
 
  37     scale_fill_manual("Absences", values=color.gradient) +
 
  42 png("questions_absenses_boxplots.png", units="px", width=800, height=600)
 
  45     aes(x=as.factor(num.calls), y=num.present) +
 
  47     scale_x_discrete("Number of questions asked") +
 
  48     scale_y_continuous("Number of questions present")