-d <- merge(d, attendance.counts, all.x=TRUE, all.y=TRUE, by="discord.name"); d
+d <- merge(d, attendance.counts,
+ all.x=TRUE, all.y=TRUE,
+ by="discord.name")
+
+days.list <- lapply(unique(attendance$day), function (day) {
+ day.total <- table(call.list$day == day)[["TRUE"]]
+ lapply(d$discord.name, function (discord.name) {
+ num.present <- nrow(attendance[attendance$day == day & attendance$discord.name == discord.name,])
+ data.frame(discord.name=discord.name,
+ days.present=(num.present/day.total))
+ })
+})
+
+days.tmp <- do.call("rbind", lapply(days.list, function (x) do.call("rbind", x)))
+
+days.tbl <- tapply(days.tmp$days.present, days.tmp$discord.name, sum)
+
+attendance.days <- data.frame(discord.name=names(days.tbl),
+ days.present=days.tbl,
+ days.absent=length(list.files(".", pattern="^attendance-.*tsv$"))-days.tbl)