library(dplyr)
library(tibble)
library(ggplot2)
# Function to load the dataset from a CSV file and return it as a tibble
load_dataset <- function(file_path) {
# Read the CSV file and convert to tibble
dataset <- read.csv(file_path, header = TRUE, stringsAsFactors = FALSE)
return(as_tibble(dataset))
}
analyze_by_task_type <- function(dataset) {
dataset <- dataset %>%
mutate(
response.time = as.numeric(response.time),
correct = ifelse(correct == "correct", TRUE, FALSE)
)
stats <- dataset %>%
group_by(task.type) %>%
summarise(
mean_response_time = mean(response.time, na.rm = TRUE),
accuracy_rate = mean(correct, na.rm = TRUE),
count = n()
)
return(stats)
}