simple R script to track participation
[coldcallbot-discord.git] / data / track_participation.R
1 library(ggplot2)
2
3 gs <- read.delim("student_information.tsv")
4 d <- gs[,c(2,5)]
5 colnames(d) <- c("student.num", "discord.name")
6
7 call.list <- do.call("rbind", lapply(list.files(".", pattern="^call_list-.*tsv$"), function (x) {read.delim(x)}))
8 colnames(call.list) <- gsub("_", ".", colnames(call.list))
9
10 call.counts <- data.frame(table(call.list$discord.name))
11 colnames(call.counts) <- c("discord.name", "num.calls")
12
13 d <- merge(d, call.counts, all.x=TRUE, all.y=TRUE, by="discord.name"); d
14
15 ## set anything that's missing to zero
16 d$num.calls[is.na(d$num.calls)] <- 0
17       
18 attendance <- unlist(lapply(list.files(".", pattern="^attendance-.*tsv$"), function (x) {d <- read.delim(x); strsplit(d[[2]], ",")}))
19
20 attendance.counts <- data.frame(table(attendance))
21 colnames(attendance.counts) <- c("discord.name", "num.present")
22
23 d <- merge(d, attendance.counts, all.x=TRUE, all.y=TRUE, by="discord.name"); d
24

Community Data Science Collective || Want to submit a patch?