-setwd("~/online_communities/coldcallbot/data/")
+setwd("~/online_communities/coldcall_scripts-COM481-2024Q4/data/")
library(data.table)
## LOAD call_list TSV data
################################################
-call.list <- do.call("rbind", lapply(list.files(".", pattern="^call_list-.*tsv$"), function (x) {read.delim(x, stringsAsFactors=FALSE)[,1:4]}))
+call.list <- do.call("rbind", lapply(list.files(".", pattern="^call_list-.*tsv$"), function (x) {read.delim(x, stringsAsFactors=FALSE)[,1:5]}))
colnames(call.list) <- gsub("_", ".", colnames(call.list))
+colnames(call.list)[1] <- "unique.name"
+colnames(call.list)[2] <- "preferred.name"
table(call.list$unique.name[call.list$answered])
missing.in.class <- call.list.full[!call.list.full$answered,
c("unique.name", "timestamp")]
missing.in.class$date.absent <- as.Date(missing.in.class$timestamp)
-missing.in.class$reported <- FALSE
+missing.in.class$reported <- rep(FALSE, nrow(missing.in.class))
missing.in.class <- missing.in.class[,absence.data.cols]
missing.in.class <- unique(missing.in.class)
## LOAD absence data TSV data
################################################
-absence.google <- read.delim("absence_poll_data.tsv")
+absence.google <- read.delim("optout_poll_data.tsv")
colnames(absence.google) <- c("timestamp", "unique.name", "date.absent")
absence.google$date.absent <- as.Date(absence.google$date.absent, format="%m/%d/%Y")
absence.google$reported <- TRUE
table(d$num.calls, d$absences)
-ggplot(data=d) +
- aes(x=as.factor(num.calls), y=absences) +
- geom_violin()
-
-## png("questions_absence_histogram_combined.png", units="px", width=600, height=400)
+png("questions_absence_histogram_combined.png", units="px", width=600, height=400)
ggplot(d) +
aes(x=as.factor(num.calls), fill=as.factor(absences)) +
geom_bar(color="black") +
stat_count() +
- scale_x_discrete("Number of questions asked") +
+ scale_x_discrete("Number of questions answered") +
scale_y_continuous("Number of students") +
##scale_fill_brewer("Absences", palette="Blues") +
- scale_fill_manual("Absences", values=color.gradient) +
+ scale_fill_manual("Opt-outs", values=color.gradient) +
theme_bw()
-## dev.off()
+dev.off()
absence.labeller <- function (df) {
lapply(df, function (x) { paste("Absences:", x) })
## png("questions_absence_histogram_facets.png", units="px", width=600, height=400)
-ggplot(d) +
- aes(x=as.factor(num.calls)) +
- geom_bar() +
- stat_count() +
- scale_x_discrete("Number of questions asked as of 2020-02-12") +
- scale_y_continuous("Number of students") +
- theme_bw() +
- facet_wrap(.~absences, ncol=5, labeller="absence.labeller")
+## ggplot(d) +
+## aes(x=as.factor(num.calls)) +
+## geom_bar() +
+## stat_count() +
+## scale_x_discrete("Number of questions answered") +
+## scale_y_continuous("Number of students") +
+## theme_bw() +
+## facet_wrap(.~absences, ncol=5, labeller="absence.labeller")