library(data.table) library(ggplot2) library(ggpubr)

d <- data

Question 1

data_path <- “C:/Users/vijay/OneDrive/Documents/BOBBY/2020/stroop-master-data/data” file_list <- list.files(path = data_path, pattern = “\.csv$”, full.names = TRUE)

file_size_vector <- c() for (i in 1:length(file_list)) { file_size_vector <- c(file_size_vector, file.size(file_list[i])) }

file_size_dt <- data.table(file_list, file_size_vector)

Question 2:

ggplot(file_size_dt, aes(x = file_size_vector)) + geom_histogram(bins = 100, fill = “blue”, color = “black”) + labs(title = “Histogram of File Sizes”, x = “File Size (bytes)”, y = “Frequency”) + theme_minimal()

d_list <- list() for (i in 1:length(file_list)) { if (file_size_vector[i] > 5) { d <- fread(file_list[i]) d_list[[i]] <- d } }

dd <- rbindlist(d_list, fill = TRUE)

dd[, date_time := as.POSIXct(date, format = “%Y-%m-%d_%Hh%M.%S.%OS”)]

ggplot(dd, aes(x = date_time)) + geom_histogram(binwidth = 86400, color = “black”, fill = “blue”) + scale_x_datetime(date_breaks = “1 month”, date_labels = “%b %Y”) + labs(title = “Histogram of Dates”, x = “Date”, y = “Frequency”) + theme_minimal()

dd <- dd[date_time < as.POSIXct(“2024-01-01”)]

ggplot(dd, aes(x = date_time)) + geom_histogram(binwidth = 86400, color = “black”, fill = “blue”) + scale_x_datetime(date_breaks = “1 month”, date_labels = “%b %Y”) + labs(title = “Histogram of Dates”, x = “Date”, y = “Frequency”) + theme_minimal()

Question 3:

percentile_99 <- quantile(dd$resp.rt, 0.99, na.rm = TRUE)

filtered_data <- dd[resp.rt <= percentile_99]

ggplot(filtered_data, aes(x = resp.rt)) + geom_histogram(binwidth = 0.1, color = “black”, fill = “black”) + labs(title = “Histogram of Response Times”, x = “Response Time (s)”, y = “Frequency”) + theme_minimal()

Question 4

filtered_data[, accuracy := ifelse(resp.corr == 1, 1, 0)]

subject_stats <- filtered_data[, .(mean_accuracy = mean(accuracy, na.rm = TRUE), mean_resp_time = mean(resp.rt, na.rm = TRUE)), by = participant]

subject_stats <- subject_stats[mean_accuracy >= 0.5]

ggplot(subject_stats, aes(x = mean_resp_time)) + geom_histogram(binwidth = 0.1, fill = “blue”, color = “black”) + labs(title = “Histogram of Mean Response Times”, x = “Mean Response Time (s)”, y = “Frequency”) + theme_minimal()

ggplot(subject_stats, aes(x = mean_accuracy)) + geom_histogram(binwidth = 0.05, fill = “blue”, color = “black”) + labs(title = “Histogram of Mean Response Accuracy”, x = “Mean Response Accuracy”, y = “Frequency”) + theme_minimal()

Question 5

filtered_data[, accuracy := resp.corr]

stroop_effect <- filtered_data[, .(mean_resp_time = mean(resp.rt, na.rm = TRUE), mean_accuracy = mean(accuracy, na.rm = TRUE)), by = congruent]

ggplot(stroop_effect, aes(x = congruent, y = mean_resp_time, fill = congruent)) + geom_bar(stat = “identity”) + labs(title = “Mean Response Time by Congruency”, x = “Congruency”, y = “Mean Response Time”) + theme_minimal()

ggplot(stroop_effect, aes(x = congruent, y = mean_accuracy, fill = congruent)) + geom_bar(stat = “identity”) + labs(title = “Mean Accuracy by Congruency”, x = “Congruency”, y = “Mean Accuracy”) + theme_minimal()