if(!require(psych)){install.packages("psych")} if(!require(likert)){install.packages("likert")} defaultpath <- dirname(rstudioapi::getActiveDocumentContext()$path) setwd(defaultpath) file <-"user_answers_ms.csv" mydata <- read.table(file, 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 <- dataFile tmp <- dataFile [ which (dataFile$is_training == "False"),] # keep trials that are not training tmp <- tmp [ order(tmp$user, tmp$vis), ] # myvars <- c("user", "vis", "question_code","question_internal_id","confidence") tmp <- tmp [myvars] tmp <- reshape(tmp, timevar="vis", idvar=c("user","question_code","question_internal_id"), direction="wide") colnames(tmp) <- gsub("confidence.", "", colnames(tmp)) tmp <- na.omit(tmp) likert_table <- tmp myvars <- c("Barchart", "Dorling","Symbol") # Symbol name has been changed in paper to Glyph likert_table <- likert_table[myvars] likert_table$Barchart = factor (likert_table$Barchart, levels = c("1","2","3"), ordered = TRUE) likert_table$Dorling = factor (likert_table$Dorling, levels = c("1","2","3"), ordered = TRUE) likert_table$Symbol = factor (likert_table$Symbol, 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") ggsave(paste0(path,"plot_",filename,".pdf",seq=""),device = pdf, width=8, height=2)