REE-RL-Lola/load_data.R
2025-12-01 21:07:40 +01:00

20 lines
640 B
R

library(dplyr)
full_data <- read.csv("data/data_fourchoices.csv")
# mapping of button names to choice numbers
button_mapping <- c(
"antifragile" = 1,
"robuste" = 2,
"fragile" = 3,
"vulnerable" = 4
)
data <- full_data[, c("participant", "click_number", "button_name", "button_value")] %>%
rename(participant_id = participant, trial = click_number, choice = button_name, reward = button_value) %>%
mutate(
option = choice,
choice = button_mapping[choice]
) %>%
select(participant_id, trial, choice, reward, option) -> data
write.csv(data, file = "data/prepared_data.csv", row.names = FALSE)