simple R script to track participation
authorBenjamin Mako Hill <mako@atdot.cc>
Thu, 15 Oct 2020 02:42:07 +0000 (19:42 -0700)
committerBenjamin Mako Hill <mako@atdot.cc>
Thu, 15 Oct 2020 02:42:07 +0000 (19:42 -0700)
lits two things:

- number of times folks have been called on
- number of times folks have bee absent/present

data/track_participation.R [new file with mode: 0644]

diff --git a/data/track_participation.R b/data/track_participation.R
new file mode 100644 (file)
index 0000000..d44e74d
--- /dev/null
@@ -0,0 +1,24 @@
+library(ggplot2)
+
+gs <- read.delim("student_information.tsv")
+d <- gs[,c(2,5)]
+colnames(d) <- c("student.num", "discord.name")
+
+call.list <- do.call("rbind", lapply(list.files(".", pattern="^call_list-.*tsv$"), function (x) {read.delim(x)}))
+colnames(call.list) <- gsub("_", ".", colnames(call.list))
+
+call.counts <- data.frame(table(call.list$discord.name))
+colnames(call.counts) <- c("discord.name", "num.calls")
+
+d <- merge(d, call.counts, all.x=TRUE, all.y=TRUE, by="discord.name"); d
+
+## set anything that's missing to zero
+d$num.calls[is.na(d$num.calls)] <- 0
+      
+attendance <- unlist(lapply(list.files(".", pattern="^attendance-.*tsv$"), function (x) {d <- read.delim(x); strsplit(d[[2]], ",")}))
+
+attendance.counts <- data.frame(table(attendance))
+colnames(attendance.counts) <- c("discord.name", "num.present")
+
+d <- merge(d, attendance.counts, all.x=TRUE, all.y=TRUE, by="discord.name"); d
+

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