From 96ea70f6820472c519bfae965b3c1b99efa3c7e4 Mon Sep 17 00:00:00 2001 From: Benjamin Mako Hill Date: Wed, 28 Oct 2020 13:11:52 -0700 Subject: [PATCH] updated participation graphing --- data/track_participation.R | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/data/track_participation.R b/data/track_participation.R index d44e74d..66ca3db 100644 --- a/data/track_participation.R +++ b/data/track_participation.R @@ -4,7 +4,7 @@ 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)})) +call.list <- do.call("rbind", lapply(list.files(".", pattern="^call_list-.*tsv$"), function (x) {read.delim(x)[,1:3]})) colnames(call.list) <- gsub("_", ".", colnames(call.list)) call.counts <- data.frame(table(call.list$discord.name)) @@ -22,3 +22,30 @@ colnames(attendance.counts) <- c("discord.name", "num.present") d <- merge(d, attendance.counts, all.x=TRUE, all.y=TRUE, by="discord.name"); d + +color.gradient <- scales::seq_gradient_pal("yellow", "magenta", "Lab")(seq(0,1,length.out=length(unique(d$num.present)))) + +png("questions_absence_histogram_combined.png", units="px", width=800, height=600) + +ggplot(d) + + aes(x=as.factor(num.calls), fill=as.factor(num.present)) + + geom_bar(color="black") + + stat_count() + + scale_x_discrete("Number of questions asked") + + scale_y_continuous("Number of students") + + # scale_fill_brewer("Absences") + + scale_fill_manual("Absences", values=color.gradient) + + theme_bw() + +dev.off() + +png("questions_absenses_boxplots.png", units="px", width=800, height=600) + +ggplot(data=d) + + aes(x=as.factor(num.calls), y=num.present) + + geom_boxplot() + + scale_x_discrete("Number of questions asked") + + scale_y_continuous("Number of questions present") + +dev.off() + -- 2.39.5