if(!require(psych)){install.packages("psych")} if(!require(likert)){install.packages("likert")} library(data.table) ## READ AGGREGATED DATA defaultpath <- dirname(rstudioapi::getActiveDocumentContext()$path) setwd(defaultpath) if (exists ("mydata")) { rm(mydata) } mydata <- read.table("aggregated_data.csv", header=T, sep=",") # collect all trials in order to calculate average error rate and time per question per participant, keep non training trials (isTraining = "False") tmp <- mydata tmp <- tmp [ order(tmp$user, tmp$vis), ] # myvars <- c("user", "vis", "question_code","question_internal_id", "mean_confidence") tmp <- tmp [myvars] tmp <- reshape(tmp, timevar="vis", idvar=c("user","question_code","question_internal_id"), direction="wide") colnames(tmp) <- gsub("mean_confidence.", "", colnames(tmp)) tmp <- na.omit(tmp) setnames(tmp, old=c("SmallMultiples","Animation", "OneMap"), new=c("SMul","Ani", "Gly")) likert_table <- tmp myvars <- c("SMul", "Ani","Gly") # Symbol name has been changed in paper to Glyph likert_table <- likert_table[myvars] likert_table$SMul = factor (likert_table$SMul, levels = c("1","2","3"), ordered = TRUE) likert_table$Ani = factor (likert_table$Ani, levels = c("1","2","3"), ordered = TRUE) likert_table$Gly = factor (likert_table$Gly, levels = c("1","2","3"), ordered = TRUE) library(psych) headTail(likert_table) str(likert_table) library(likert) Result=likert(likert_table) summary(Result) path = paste("plots/") filename = paste("conf_task_all") plot(Result, type="bar", group.order=c("SMul", "Ani", "Gly")) + theme(axis.title.x = element_blank(), plot.background = element_blank(), panel.background = element_blank(), text = element_text(size = 20, color = 'black')) + ggtitle('') ggsave(paste0(path,"plot_",filename,".pdf",seq=""),device = "pdf", width=8, height=2)