1 Document Overview:

In this document, for each dataset in which we have individual infant level data, we:

  1. modify and save dataset such that data is in a rectangular format

  2. modify and save dataset such that all datasets have the same column names

2 Imports

options(scipen = 1, digits = 3)
library(pacman)

pacman::p_load(tidyverse,
               dplyr,
               naniar,
               haven,
               readr)

sessionInfo()
## R version 4.3.2 (2023-10-31)
## Platform: x86_64-apple-darwin20 (64-bit)
## Running under: macOS Monterey 12.6.7
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRblas.0.dylib 
## LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## time zone: America/New_York
## tzcode source: internal
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] haven_2.5.3     naniar_1.0.0    lubridate_1.9.3 forcats_1.0.0  
##  [5] stringr_1.5.0   dplyr_1.1.3     purrr_1.0.2     readr_2.1.4    
##  [9] tidyr_1.3.0     tibble_3.2.1    ggplot2_3.4.4   tidyverse_2.0.0
## [13] pacman_0.5.1   
## 
## loaded via a namespace (and not attached):
##  [1] gtable_0.3.4      jsonlite_1.8.7    compiler_4.3.2    visdat_0.6.0     
##  [5] tidyselect_1.2.0  jquerylib_0.1.4   scales_1.2.1      yaml_2.3.7       
##  [9] fastmap_1.1.1     R6_2.5.1          generics_0.1.3    knitr_1.45       
## [13] munsell_0.5.0     tzdb_0.4.0        bslib_0.5.1       pillar_1.9.0     
## [17] rlang_1.1.1       utf8_1.2.4        stringi_1.7.12    cachem_1.0.8     
## [21] xfun_0.40         sass_0.4.7        timechange_0.2.0  cli_3.6.1        
## [25] withr_2.5.2       magrittr_2.0.3    digest_0.6.33     grid_4.3.2       
## [29] rstudioapi_0.15.0 hms_1.1.3         lifecycle_1.0.3   vctrs_0.6.4      
## [33] evaluate_0.22     glue_1.6.2        fansi_1.0.5       colorspace_2.1-0 
## [37] rmarkdown_2.25    tools_4.3.2       pkgconfig_2.0.3   htmltools_0.5.6.1

3 Parsing through each dataset to save into common format

3.1 Chuey 2021

3.1.1 Rectangular format

chuey_2021_raw <- read_csv('orig_data_(1)/chuey_2021.csv')
## New names:
## Rows: 660 Columns: 9
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (6): subj, sample, sex, first.test, trial, trialtype dbl (3): ...1, agem, look
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
chuey_2021_fixed <- chuey_2021_raw %>%
  filter(sample == "online")%>%
  select(subj, sample, sex, agem, first.test, trial, look)%>%
  pivot_wider(names_from = "trial", values_from = "look")

write.csv(chuey_2021_fixed,"orig_data_cleaned_(2)/chuey_2021.csv", row.names = FALSE)

3.1.2 Common format

chuey_2021_common_format <- chuey_2021_fixed %>%
  mutate(agedays = agem * 30.44) %>%
  mutate(paper = "chuey_2021") %>%
  mutate(expt_num = 4, expt_cond = "4_online") %>%
  mutate(order = first.test) %>%
  mutate(training_type = "fam") %>%
  mutate(expected1 = ifelse(order == "exp", test1, test2)) %>%
  mutate(unexpected1 = ifelse(order == "unexp", test1, test2)) %>%
  mutate(expected2 = ifelse(order == "exp", test3, test4)) %>%
  mutate(unexpected2 = ifelse(order == "unexp", test3, test4)) %>%
  mutate(train1 = fam1, train2 = fam2, train3 = fam3, train4 = fam4, train5 = fam5, train6 = fam6) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(chuey_2021_common_format,"outputs_(3)/chuey_2021.csv", row.names = FALSE)

3.2 Liu 2019

3.2.1 Rectangular Format

liu_2019_skerry_2013_raw <- read_csv('orig_data_(1)/liu_2019_and_skerry_2013.csv')
## Rows: 264 Columns: 49
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (12): paper, subj_id, experiment, stimuli, training, hab, first.test, go...
## dbl (37): reliability, ageday, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11,...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
liu_2019_fixed <- liu_2019_skerry_2013_raw %>%
  filter(paper == "LBS")

skerry_2013_fixed <- liu_2019_skerry_2013_raw %>%
  filter(paper == "SCS")

write.csv(liu_2019_fixed,"orig_data_cleaned_(2)/liu_2019.csv", row.names = FALSE)
write.csv(skerry_2013_fixed,"orig_data_cleaned_(2)/skerry_2013.csv", row.names = FALSE)

3.2.2 Common Format

liu_2019_common_format <- liu_2019_fixed %>%
  mutate(agedays = ageday) %>%
  mutate(paper = "liu_2019") %>%
  mutate_at("experiment", str_replace, "Exp.", "")%>%
  mutate(expt_num = experiment, expt_cond = ifelse(experiment != 3 & experiment!= 5, experiment, ifelse(stimuli == "H3, T3" & experiment == 3, "3_experimental", ifelse(stimuli == "H4, T3", "3_control", ifelse(stimuli == "H5, T4", "5_noncausal", "5_causal"))))) %>%
  mutate(subj = subj_id) %>%
  mutate(order = ifelse(first.test == "efficient", "exp", "unexp")) %>%
  mutate(training_type = "hab") %>%
  mutate(expected1 = eff.1) %>%
  mutate(unexpected1 = ineff.1) %>%
  mutate(expected2 = eff.2) %>%
  mutate(unexpected2 = ineff.2) %>%
  mutate(expected3 = eff.3) %>%
  mutate(unexpected3 = ineff.3) %>%
  mutate(train1 = H1, train2 = H2, train3 = H3, train4 = H4, train5 = H5, train6 = H6, train7 = H7, train8 = H8, train9 = H9, train10 = H10, train11 = H11, train12 = H12) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"), -c(training))


skerry_2013_common_format <- skerry_2013_fixed %>%
  mutate(agedays = ageday) %>%
  mutate(paper = "skerry_2013") %>%
  mutate_at("experiment", str_replace, "SCS.Exp.", "")%>%
  mutate(expt_num = experiment, expt_cond = experiment) %>%
  mutate(subj = subj_id) %>%
  mutate(order = ifelse(first.test == "efficient", "exp", "unexp")) %>%
  mutate(training_type = "hab") %>%
  mutate(expected1 = eff.1) %>%
  mutate(unexpected1 = ineff.1) %>%
  mutate(expected2 = eff.2) %>%
  mutate(unexpected2 = ineff.2) %>%
  mutate(expected3 = eff.3) %>%
  mutate(unexpected3 = ineff.3) %>%
  mutate(train1 = H1, train2 = H2, train3 = H3, train4 = H4, train5 = H5, train6 = H6, train7 = H7, train8 = H8, train9 = H9, train10 = H10, train11 = H11, train12 = H12) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"), -c(training))

write.csv(liu_2019_common_format,"outputs_(3)/liu_2019.csv", row.names = FALSE)

3.3 Liu 2022

3.3.1 Rectangular Format

liu_2022_raw <- read_csv('orig_data_(1)/liu_2022.csv')
## Rows: 286 Columns: 40
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (31): sex, subj, experiment, exp_oldmapping, exp, cost, device, HV_side,...
## dbl  (9): reliability, agem, video_quality, audio_quality, highchair, avg_fa...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
liu_2022_fixed <- liu_2022_raw %>%
  filter(grepl("Exp4.", exp))

write.csv(liu_2022_fixed,"orig_data_cleaned_(2)/liu_2022.csv", row.names = FALSE)

3.3.2 Common format

liu_2022_common_format <- liu_2022_fixed %>%
  mutate(agedays = agem * 30.44) %>%
  mutate(paper = "liu_2022") %>%
  mutate(expt_num = 4) %>%
  mutate(expt_cond = ifelse(exp == "Exp4.Study1", "4_study1", ifelse(exp == "Exp4.Study2", "4_study2", "4_study3"))) %>%
  mutate(order = ifelse(first_test == "HV" | first_test == "shallow", "exp", "unexp")) %>%
  mutate(training_type = "fam") %>%
  mutate(expected1 = ifelse(order == "exp", test1, test2)) %>%
  mutate(unexpected1 = ifelse(order == "unexp", test1, test2)) %>%
  mutate(expected2 = ifelse(order == "exp", test3, test4)) %>%
  mutate(unexpected2 = ifelse(order == "unexp", test3, test4)) %>%
  mutate(train1 = fam1, train2 = fam2, train3 = fam3, train4 = fam4, train5 = fam5, train6 = fam6) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(liu_2022_common_format,"outputs_(3)/liu_2022.csv", row.names = FALSE)

3.4 Hespos 2009

3.4.1 Common format

hespos_2009_fixed <- read_csv('orig_data_cleaned_(2)/hespos_2009.csv')
## Rows: 31 Columns: 18
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (3): age, order, sex
## dbl (15): exp, subj, H1, H2, H3, H_3, H_2, H_1, num_hab, T1, T2, T3, T4, T5, T6
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
hespos_2009_fixing <- hespos_2009_fixed %>%
  separate(col = age, into = c("months", "days"))
  
hespos_2009_fixing$months = as.numeric(as.character(hespos_2009_fixing$months))
hespos_2009_fixing$days = as.numeric(as.character(hespos_2009_fixing$days))

hespos_2009_common_format <- hespos_2009_fixing%>%
  mutate(agedays = months * 30.44 + days) %>%
  mutate(paper = "hespos_2009") %>%
  mutate(expt_num = exp, expt_cond = paste(exp, "_habtosolid"))%>%
  mutate(training_type = "hab") %>%
  mutate(expected1 = ifelse(order == "exp", T1, T2)) %>%
  mutate(unexpected1 = ifelse(order == "unexp", T1, T2)) %>%
  mutate(expected2 = ifelse(order == "exp", T3, T4)) %>%
  mutate(unexpected2 = ifelse(order == "unexp", T3, T4)) %>%
  mutate(expected3 = ifelse(order == "exp", T5, T6)) %>%
  mutate(unexpected3 = ifelse(order == "unexp", T5, T6)) %>%
  mutate(train1 = H1, train2 = H2, train3 = H3, train4 = H_3, train5 = H_2, train6 = H_1) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(hespos_2009_common_format,"outputs_(3)/hespos_2009.csv", row.names = FALSE)

3.5 Luo 2005a

3.5.1 Common format

luo_2005a_fixed <- read_csv('orig_data_cleaned_(2)/luo_2005a.csv')
## Rows: 48 Columns: 16
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (3): Condition, Order, Gender
## dbl (13): expt, subj, Agem, Aged, Orient1, Orient2, fam1, fam2, fam3, fam4, ...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
luo_2005a_fixed$Agem = as.numeric(as.character(luo_2005a_fixed$Agem))
luo_2005a_fixed$Aged = as.numeric(as.character(luo_2005a_fixed$Aged))
luo_2005a_fixed$Order[luo_2005a_fixed$Order == "New-goal first"] <- "unexp"
luo_2005a_fixed$Order[luo_2005a_fixed$Order == "Old-goal first"] <- "exp"


luo_2005a_common_format <- luo_2005a_fixed %>%
  mutate(agedays = Agem*30.44 + Aged) %>%
  mutate(paper = "luo_2005a") %>%
  mutate(order = Order) %>%
  mutate(expt_num = expt) %>%
  mutate(expt_cond = ifelse(Condition == "Experimental", "1_experimental", ifelse(Condition == "Control", "1_control", ifelse(Condition == "Short-handle", "2_shorthandle", "2_longhandle")))) %>%
  mutate(training_type = "fam") %>%
  mutate(expected1 = old_goal) %>%
  mutate(unexpected1 = new_goal) %>%
  mutate(sex = Gender) %>%
  mutate(train1 = fam1, train2 = fam2, train3 = fam3, train4 = fam4) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(luo_2005a_common_format,"outputs_(3)/luo_2005a.csv", row.names = FALSE)

3.6 Luo 2005b

3.6.1 Common format

luo_2005b_fixed <- read_csv('orig_data_cleaned_(2)/luo_2005b.csv')
## Rows: 16 Columns: 17
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (4): paper, expt_cond, sex, order
## dbl (13): expt_num, subj, agedays, F1, F2, F3, F4, F5, F6, Display (continuo...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
luo_2005b_common_format <- luo_2005b_fixed %>%
  mutate(training_type = "fam") %>%
  mutate(order = ifelse((order == "discontinuousloweredge" & expt_cond == "1_ca")|(order == "continuousloweredge" & expt_cond == "1_cdna"), "exp", "unexp"))%>%
  mutate(expected1 = ifelse(expt_cond == "1_ca", test_discontinuous_lower_edge, test_continuous_lower_edge)) %>%
  mutate(unexpected1 = ifelse(expt_cond == "1_cdna", test_discontinuous_lower_edge, test_continuous_lower_edge)) %>%
  mutate(train1 = F1, train2 = F2, train3 = F3, train4 = F4, train5 = F5, train6 = F6) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(luo_2005b_common_format,"outputs_(3)/luo_2005b.csv", row.names = FALSE)

3.7 Luo 2009a

3.7.1 Common format

luo_2009a_fixed <- read_csv('orig_data_cleaned_(2)/luo_2009a.csv')
## Rows: 60 Columns: 14
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (4): paper, expt_cond, order, sex
## dbl (10): expt_num, subj, agem, aged, fam1, fam2, fam3, fam4, new_goal, old_...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
luo_2009a_common_format <- luo_2009a_fixed %>%
  mutate(training_type = "fam") %>%
  mutate(order = ifelse(order == "Old-goal first", "exp", "unexp"))%>%
  mutate(agedays = agem*30.44 + aged)%>%
  mutate(expected1 = old_goal) %>%
  mutate(unexpected1 = new_goal) %>%
  mutate(train1 = fam1, train2 = fam2, train3 = fam3, train4 = fam4) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(luo_2009a_common_format,"outputs_(3)/luo_2009a.csv", row.names = FALSE)

3.8 Luo 2009b

3.8.1 Common format

luo_2009b_exp1_fixed <- read_csv('orig_data_cleaned_(2)/luo_2009b_exp1.csv')
## Rows: 32 Columns: 18
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (4): paper, expt_cond, order, sex
## dbl (14): expt_num, subj, agem, aged, Ffar1, Fnear1, Ffar2, Fnear2, Ffar3, F...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
luo_2009b_exp2_fixed <- read_csv('orig_data_cleaned_(2)/luo_2009b_exp2.csv')
## Rows: 32 Columns: 20
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (4): paper, expt_cond, order, sex
## dbl (16): expt_num, subj, agem, aged, F1, F2, F3, F4, F5, F6, Orient(block),...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
luo_2009b_exp1_common_format <- luo_2009b_exp1_fixed %>%
  mutate(training_type = "fam") %>%
  mutate(order = ifelse(order == "near-wall first", "exp", "unexp"))%>%
  mutate(agedays = agem*30.44 + aged)%>%
  mutate(expected1 = Tnear1) %>%
  mutate(unexpected1 = Tfar1) %>%
  mutate(expected2 = Tnear2) %>%
  mutate(unexpected2 = Tfar2) %>%
  mutate(train1 = ifelse(order == "exp",Fnear1,Ffar1), 
         train2 = ifelse(order == "exp",Ffar1,Fnear1),
         train3 = ifelse(order == "exp",Fnear2,Ffar2), 
         train4 = ifelse(order == "exp",Ffar2,Fnear2),
         train5 = ifelse(order == "exp",Fnear3,Ffar3), 
         train6 = ifelse(order == "exp",Ffar3,Fnear3)) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

luo_2009b_exp2_common_format <- luo_2009b_exp2_fixed %>%
  mutate(training_type = "fam") %>%
  mutate(order = ifelse(order == "Table first", "exp", "unexp"))%>%
  mutate(agedays = agem*30.44 + aged)%>%
  mutate(expected1 = Ttable1) %>%
  mutate(unexpected1 = Tblock1) %>%
  mutate(expected2 = Ttable2) %>%
  mutate(unexpected2 = Tblock2) %>%
  mutate(train1 = F1, train2 = F2, train3 = F3, train4 = F4, train5 = F5, train6 = F6) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

luo_2009b_common_format <-rbind(luo_2009b_exp1_common_format, luo_2009b_exp2_common_format)

write.csv(luo_2009b_common_format,"outputs_(3)/luo_2009b.csv", row.names = FALSE)

3.9 Luo 2010

3.9.1 Common Format

luo_2010_fixed <- read_csv('orig_data_cleaned_(2)/luo_2010.csv')
## Rows: 40 Columns: 16
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (4): paper, expt_cond, order, sex
## dbl (12): expt_num, subj, agem, aged, fam1, fam2, fam3, fam4, new_goal1, old...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
luo_2010_common_format <- luo_2010_fixed %>%
  mutate(training_type = "fam") %>%
  mutate(order = ifelse(order == "Old-goal first", "exp", "unexp"))%>%
  mutate(agedays = agem*30.44 + aged)%>%
  mutate(expected1 = old_goal1) %>%
  mutate(unexpected1 = new_goal1) %>%
  mutate(expected2 = old_goal2) %>%
  mutate(unexpected2 = new_goal2) %>%
  mutate(train1 = fam1, train2 = fam2, train3 = fam3, train4 = fam4) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(luo_2010_common_format,"outputs_(3)/luo_2010.csv", row.names = FALSE)

3.10 Martin 2017

3.10.1 Common Format

martin_2017_fixed <- read_csv('orig_data_cleaned_(2)/martin_2017.csv')
## Rows: 160 Columns: 36
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (8): Condition, Sex, DOT, Order, Target, TSideHab, Hab, Comments
## dbl (28): Subj, Experiment, RoomPair, agem, aged, Preview, Hab1, Hab2, Hab3,...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
martin_2017_common_format <- martin_2017_fixed %>%
  mutate(paper = "martin_2017") %>%
  mutate(expt_num = Experiment) %>%
  mutate(expt_cond = ifelse(expt_num ==1, ifelse(Condition == "label_switchroom", "1_preference", "1_choice"), expt_num)) %>%
  mutate(training_type = "hab") %>%
  mutate(subj = Subj) %>%
  mutate(sex = Sex) %>%
  mutate(order = ifelse(Order == "oldfirst", "exp", "unexp"))%>%
  mutate(agedays = agem*30.44 + aged)%>%
  mutate(expected1 = ifelse(order == "exp", Test1, Test2)) %>%
  mutate(unexpected1 = ifelse(order == "exp", Test2, Test1)) %>%
  mutate(expected2 = ifelse(order == "exp", Test3, Test4)) %>%
  mutate(unexpected2 = ifelse(order == "exp", Test4, Test3)) %>%
  mutate(expected3 = ifelse(order == "exp", Test5, Test6)) %>%
  mutate(unexpected3 = ifelse(order == "exp", Test6, Test5)) %>%
  mutate(train1 = Hab1, train2 = Hab2, train3 = Hab3, train4 = Hab4, train5 = Hab5, train6 = Hab6,
         train7 = Hab7, train8 = Hab8, train9 = Hab9, train10 = Hab10, train11 = Hab11, train12 = Hab12, train13 = Hab13, train14 = Hab14) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(martin_2017_common_format,"outputs_(3)/martin_2017.csv", row.names = FALSE)

3.11 Powell unpublished

3.11.1 Common Format

powell_unpublished_fixed <- read_csv('orig_data_cleaned_(2)/powell_unpublished.csv')
## Rows: 60 Columns: 12
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (2): Sex, CB
## dbl (10): Subject, Age, F1, F2, F3, F4, T1, T2, T3, T4
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
powell_unpublished_common_format <- powell_unpublished_fixed %>%
  mutate(paper = "powell_unpublished") %>%
  mutate(expt_num = 1) %>%
  mutate(expt_cond = 1) %>%
  mutate(training_type = "fam") %>%
  mutate(subj = Subject) %>%
  mutate(sex = Sex) %>%
  mutate(order = ifelse(CB == "EU", "exp", "unexp"))%>%
  mutate(agedays = Age*30.44)%>%
  mutate(expected1 = ifelse(order == "exp", T1, T2)) %>%
  mutate(unexpected1 = ifelse(order == "exp", T2, T1)) %>%
  mutate(expected2 = ifelse(order == "exp", T3, T4)) %>%
  mutate(unexpected2 = ifelse(order == "exp", T4, T3)) %>%
  mutate(train1 = F1, train2 = F2, train3 = F3, train4 = F4) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(powell_unpublished_common_format,"outputs_(3)/powell_unpublished.csv", row.names = FALSE)

3.12 Thoermer 2013

3.12.1 Common format

thoermer_2013_fixed <- read_csv('orig_data_cleaned_(2)/thoermer_2013.csv')
## New names:
## Rows: 44 Columns: 21
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (5): test3, test4, test5, test6, ...21 dbl (16): Subj, sex, Firsttestcond,
## Hab1, Hab2, Hab3, Hab4, Hab5, Hab6, Hab-...
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...19`
## • `` -> `...20`
## • `` -> `...21`
thoermer_2013_common_format <- thoermer_2013_fixed %>%
  mutate(paper = "thoermer_2013") %>%
  mutate(expt_num = 1) %>%
  mutate(expt_cond = "1_goalencoding") %>%
  mutate(training_type = "hab") %>%
  mutate(subj = Subj) %>%
  mutate(sex = ifelse(sex == 1, "m", "f")) %>%
  mutate(order = ifelse(Firsttestcond == 1, "unexp", "exp"))%>%
  mutate(expected1 = ifelse(order == "exp", test1, test2)) %>%
  mutate(unexpected1 = ifelse(order == "exp", test2, test1)) %>%
  mutate(expected2 = ifelse(order == "exp", test3, test4)) %>%
  mutate(unexpected2 = ifelse(order == "exp", test4, test3)) %>%
  mutate(expected3 = ifelse(order == "exp", test5, test6)) %>%
  mutate(unexpected3 = ifelse(order == "exp", test6, test5)) %>%
  mutate(train1 = Hab1, train2 = Hab2, train3 = Hab3, train4 = Hab4, train5 = Hab5, train6 = Hab6, train7 = `Hab-3`, train8 = `Hab-2`, train9 = `Hab-1`) %>%
  filter(subj != 11) %>% #excluding subject 11, not included in original Thoermer study
  select(paper, expt_num, expt_cond, subj, sex, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(thoermer_2013_common_format,"outputs_(3)/thoermer_2013.csv", row.names = FALSE)

3.13 Woo 2021

3.13.1 Rectangular format

woo_2021_exp1_raw <- read_csv('orig_data_(1)/woo_2021_exp1.csv')
## Rows: 300 Columns: 19
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (9): sex, trialtype, cur_obj_location, cur_goal, msg, habgoal, first.te...
## dbl (10): row_numb, subj, months, days, condlabel, duration.pyHab, trialn, d...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
woo_2021_exp1_fixed <- woo_2021_exp1_raw %>%
  filter(is.na(msg)) %>%
  mutate(trial = ifelse(trialtype == "Hab", paste("train",sep = "", trialn), ifelse(trialtype == "preTest", trialtype, ifelse(trialtype == "test" & testtrial == "old.goal", "expected", "unexpected")))) %>%
  mutate(trial = ifelse(trialtype!= "test", trial, ifelse(testPair == "first", paste(trial, sep = "", "1"), ifelse(testPair == "second", paste(trial, sep = "", "2"), ifelse(testPair == "third", paste(trial, sep = "", "3"), NA))))) %>%
  filter(!trial %in% c('preTest')) %>%
  mutate(expt_num = 1, expt_cond = "1") %>%
  mutate(order = ifelse(first.test == "same", "exp", "unexp")) %>%
  select(subj, expt_num, expt_cond, sex, agedays, order, trial, duration.pyHab)  %>%
  drop_na(trial) %>%
  pivot_wider(names_from = "trial", values_from = "duration.pyHab") %>%
  mutate(train13 = NA, train14 = NA)

write.csv(woo_2021_exp1_fixed,"orig_data_cleaned_(2)/woo_2021_exp1.csv", row.names = FALSE)

3.13.2 Common format

woo_2021_exp2_fixed <- read_csv('orig_data_cleaned_(2)/woo_2021_exp2.csv')
## Rows: 24 Columns: 33
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (7): Relabeled Script, Subject ID, Sex, Preferred Object, PO Starting L...
## dbl (26): Script, Age - Month, Age - Day, Age Decimal, PO Test Order, Video ...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
woo_2021_exp2_common_format <- woo_2021_exp2_fixed %>%
  mutate(subj = `Subject ID`) %>%
  mutate(expt_num = 2, expt_cond = 2) %>%
  mutate(sex = Sex) %>%
  mutate(agedays = `Age Decimal` *30.44) %>%
  mutate(order = ifelse(`PO Test Order` == 1, "exp", "unexp")) %>%
  mutate(expected1 = ifelse(order == "exp", `Test 1`, `Test 2`)) %>%
  mutate(unexpected1 = ifelse(order == "exp", `Test 2`, `Test 1`)) %>%
  mutate(expected2 = ifelse(order == "exp", `Test 3`, `Test 4`)) %>%
  mutate(unexpected2 = ifelse(order == "exp", `Test 4`, `Test 3`)) %>%
  mutate(expected3 = ifelse(order == "exp", `Test 5`, `Test 6`)) %>%
  mutate(unexpected3 = ifelse(order == "exp", `Test 6`, `Test 5`)) %>%
  mutate(train1 = `Habituation 1`, train2 = `Habituation 2`, train3 = `Habituation 3`, train4 = `Habituation 4`, train5 = `Habituation 5`, train6 = `Habituation 6`, train7 = `Habituation 7`, train8 = `Habituation 8`, train9 = `Habituation 9`, train10 = `Habituation 10`, train11 = `Habituation 11`, train12 = `Habituation 12`, train13 = `Habituation 13`, train14 = `Habituation 14`) %>%
  select(expt_num, expt_cond, subj, sex, agedays, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))
  
woo_2021_exp3_fixed <- read_csv('orig_data_cleaned_(2)/woo_2021_exp3.csv')
## Rows: 24 Columns: 32
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (7): Script, Subject ID, Sex, Preferred Location (L/R), Test PL Object,...
## dbl (24): Age - Month, Age - Day, Age Decimal, PL Test Order, Video Quality,...
## lgl  (1): Habituation 14
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
woo_2021_exp3_common_format <- woo_2021_exp3_fixed %>%
  mutate(subj = `Subject ID`) %>%
  mutate(expt_num = 3, expt_cond = 3) %>%
  mutate(sex = Sex) %>%
  mutate(agedays = `Age Decimal` *30.44) %>%
  mutate(order = ifelse(`PL Test Order` == 1, "exp", "unexp")) %>%
  mutate(expected1 = ifelse(order == "exp", `Test 1`, `Test 2`)) %>%
  mutate(unexpected1 = ifelse(order == "exp", `Test 2`, `Test 1`)) %>%
  mutate(expected2 = ifelse(order == "exp", `Test 3`, `Test 4`)) %>%
  mutate(unexpected2 = ifelse(order == "exp", `Test 4`, `Test 3`)) %>%
  mutate(expected3 = ifelse(order == "exp", `Test 5`, `Test 6`)) %>%
  mutate(unexpected3 = ifelse(order == "exp", `Test 6`, `Test 5`)) %>%
  mutate(train1 = `Habituation 1`, train2 = `Habituation 2`, train3 = `Habituation 3`, train4 = `Habituation 4`, train5 = `Habituation 5`, train6 = `Habituation 6`, train7 = `Habituation 7`, train8 = `Habituation 8`, train9 = `Habituation 9`, train10 = `Habituation 10`, train11 = `Habituation 11`, train12 = `Habituation 12`, train13 = `Habituation 13`, train14 = `Habituation 14`) %>%
  select(expt_num, expt_cond, subj, sex, agedays, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))


woo_2021_common_format <- rbind(woo_2021_exp1_fixed, woo_2021_exp2_common_format, woo_2021_exp3_common_format)

woo_2021_final <- woo_2021_common_format %>%
  mutate(paper = "woo_2021") %>%
  mutate(training_type = "hab")

write.csv(woo_2021_final,"outputs_(3)/woo_2021.csv", row.names = FALSE)

3.14 Choi 2018

3.14.1 Common Format

choi_2018_fixed <- read_csv('orig_data_cleaned_(2)/choi_2018.csv')
## Rows: 48 Columns: 16
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (4): condition, test_order, fam_object, sex
## dbl (12): agem, aged, F1, F2, F3, F4, F5, F6, New-goal_1, Old-goal_1, New-go...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
choi_2018_common_format <- choi_2018_fixed%>%
  mutate(agedays = agem * 30.44 + aged) %>%
  mutate(subj = row_number()) %>%
  mutate(paper = "choi_2018") %>%
  mutate(expt_num = 1, expt_cond = paste(1, ifelse(condition == "Two-object", "_twoobject", ifelse(condition == "One-object", "_oneobject", "_hidden")))) %>%
  mutate(order = ifelse(test_order == "Old-goal first", "exp", "unexp")) %>%
  mutate(training_type = "fam") %>%
  mutate(expected1 = `Old-goal_1`) %>%
  mutate(unexpected1 = `New-goal_1`) %>%
  mutate(expected2 = `Old-goal_2`) %>%
  mutate(unexpected2 = `New-goal_2`) %>%
  mutate(train1 = F1, train2 = F2, train3 = F3, train4 = F4, train5 = F5, train6 = F6) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(choi_2018_common_format,"outputs_(3)/choi_2018.csv", row.names = FALSE)

3.15 Gerson 2014a

3.15.1 Common format

gerson_2014a_fixed <- read_csv('orig_data_cleaned_(2)/gerson_2014a.csv')
## Rows: 72 Columns: 30
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (7): Condition, Sex, Object_Right, Habituation_Goal, Reach_Type, First_...
## dbl (23): Participant, Yoking, Age, Hab1, Hab2, Hab3, First3Hab, EndHab1, En...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
gerson_2014a_common_format <- gerson_2014a_fixed%>%
  mutate(agedays = Age * 30.44) %>%
  mutate(subj = Participant) %>%
  mutate(paper = "gerson_2014a") %>%
  mutate(sex = Sex) %>%
  mutate(expt_num = 1, expt_cond = paste(1, ifelse(Condition == "Observation", "_observational", ifelse(Condition == "Active", "_active", "_control")))) %>%
  mutate(order = ifelse(First_Test_Trial == "old", "exp", "unexp")) %>%
  mutate(training_type = "hab") %>%
  mutate(expected1 = `OldGoal_1`) %>%
  mutate(unexpected1 = `NewGoal_1`) %>%
  mutate(expected2 = `OldGoal_2`) %>%
  mutate(unexpected2 = `NewGoal_2`) %>%
  mutate(expected3 = `OldGoal_3`) %>%
  mutate(unexpected3 = `NewGoal_3`) %>%
  mutate(train1 = Hab1, train2 = Hab2, train3 = Hab3, train4 = EndHab1, train5 = EndHab2, train6 = EndHab3) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(gerson_2014a_common_format,"outputs_(3)/gerson_2014a.csv", row.names = FALSE)

3.16 Gerson 2014b

3.16.1 Common Format

gerson_2014b_fixed <- read_csv('orig_data_cleaned_(2)/gerson_2014b.csv')
## Rows: 90 Columns: 31
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (7): Condition, Sex, Object_Right, Habituation_Goal, Reach_Type, First_...
## dbl (24): Participant, Yoking, Age_m, Hab1, Hab2, Hab3, First3Hab, EndHab1, ...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
gerson_2014b_common_format <- gerson_2014b_fixed%>%
  mutate(agedays = Age_m * 30.44) %>%
  mutate(subj = Participant) %>%
  mutate(paper = "gerson_2014b") %>%
  mutate(sex = Sex) %>%
  mutate(expt_num = ifelse(Condition == "gen", 2, 1))%>%
  mutate(expt_cond = ifelse(expt_num == 2, 2, ifelse(Condition == "Obs", "1_observational", "1_active"))) %>%
  mutate(order = ifelse(First_Test_Trial == "old", "exp", "unexp")) %>%
  mutate(training_type = "hab") %>%
  mutate(expected1 = `OldGoal_1`) %>%
  mutate(unexpected1 = `NewGoal_1`) %>%
  mutate(expected2 = `OldGoal_2`) %>%
  mutate(unexpected2 = `NewGoal_2`) %>%
  mutate(expected3 = `OldGoal_3`) %>%
  mutate(unexpected3 = `NewGoal_3`) %>%
  mutate(train1 = Hab1, train2 = Hab2, train3 = Hab3, train4 = EndHab1, train5 = EndHab2, train6 = EndHab3) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(gerson_2014b_common_format,"outputs_(3)/gerson_2014b.csv", row.names = FALSE)

3.17 Liu 2017a

3.17.1 Common Format

liu_2017a_fixed <- read_csv('orig_data_cleaned_(2)/liu_2017a.csv')
## Rows: 60 Columns: 44
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (18): sex, order, subj, experiment, test1, test2, test3, test4, test5, t...
## dbl (24): agem, hab1, hab2, hab3, hab4, hab5, hab6, hab7, hab8, hab9, hab10,...
## lgl  (2): hab11, hab12
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
liu_2017a_common_format <- liu_2017a_fixed%>%
  mutate(agedays = agem * 30.44) %>%
  mutate(paper = "liu_2017a") %>%
  mutate(expt_num = ifelse(experiment == "Exp.1", 1, ifelse(experiment == "Exp.2", 2, 3)), expt_cond = expt_num) %>%
  mutate(order = ifelse(order == "low", "exp", "unexp")) %>%
  mutate(training_type = "hab") %>%
  mutate(expected1 = `low1`) %>%
  mutate(unexpected1 = `high1`) %>%
  mutate(expected2 = `low2`) %>%
  mutate(unexpected2 = `high2`) %>%
  mutate(expected3 = `low3`) %>%
  mutate(unexpected3 = `high3`) %>%
  mutate(train1 = hab1, train2 = hab2, train3 = hab3, train4 = hab4, train5 = hab5, train6 = hab6, train7 = hab7, train8 = hab8, train9 = hab9, train10 = hab10, train11 = hab11, train12 = hab12) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(liu_2017a_common_format,"outputs_(3)/liu_2017a.csv", row.names = FALSE)

3.18 Liu 2017b

3.18.1 Common Format

liu_2017b_fixed <- read_csv('orig_data_cleaned_(2)/liu_2017b.csv')
## Rows: 80 Columns: 29
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (11): sex, subj, experiment, cost, hv_side, first_fam, first_test, test1...
## dbl (18): agem, fam1, fam2, fam3, fam4, fam5, fam6, test2, avg_fam, sum_fam,...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
liu_2017b_common_format <- liu_2017b_fixed%>%
  mutate(agedays = agem * 30.44) %>%
  mutate(paper = "liu_2017b") %>%
  mutate(expt_num = ifelse(experiment == "Exp.1", 1, ifelse(experiment == "Exp.2", 2, 3)), expt_cond = expt_num) %>%
  mutate(order = ifelse(first_test == "HV", "exp", "unexp")) %>%
  mutate(training_type = "fam") %>%
  mutate(expected1 = `hv1`) %>%
  mutate(unexpected1 = `lv1`) %>%
  mutate(expected2 = `hv2`) %>%
  mutate(unexpected2 = `lv2`) %>%
  mutate(train1 = fam1, train2 = fam2, train3 = fam3, train4 = fam4, train5 = fam5, train6 = fam6) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(liu_2017b_common_format,"outputs_(3)/liu_2017b.csv", row.names = FALSE)

3.19 Luo 2011

3.19.1 Common format

luo_2011_fixed <- read_csv('orig_data_cleaned_(2)/luo_2011.csv')
## Rows: 36 Columns: 14
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (4): condition, order, gender, age_md
## dbl (10): orientation 1, orientation 2, F1, F2, F3, F4, F5, Display, new-goa...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
luo_2011_fixing <- luo_2011_fixed %>%
  separate(col = age_md, into = c("months", "days"))
  
luo_2011_fixing$months = as.numeric(as.character(luo_2011_fixing$months))
luo_2011_fixing$days = as.numeric(as.character(luo_2011_fixing$days))


luo_2011_common_format <- luo_2011_fixing%>%
  mutate(agedays = months * 30.44 + days) %>%
  mutate(paper = "luo_2011") %>%
  mutate(sex = gender) %>%
  mutate(subj = row_number()) %>%
  mutate(expt_num = ifelse(condition == "different-positions", 2, 1), expt_cond = ifelse(expt_num == 2, 2, ifelse(condition == "two-object", "1_twoobject", "1_oneobject"))) %>%
  mutate(order = ifelse(order == "old-goal first", "exp", "unexp")) %>%
  mutate(training_type = "fam") %>%
  mutate(expected1 = `old-goal`) %>%
  mutate(unexpected1 = `new-goal`) %>%
  mutate(train1 = F1, train2 = F2, train3 = F3, train4 = F4, train5 = F5) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(luo_2011_common_format,"outputs_(3)/luo_2011.csv", row.names = FALSE)

3.20 Skerry 2013

3.20.1 Rectangular format

skerry_2013_hab_raw <- read_csv('orig_data_(1)/skerry_2013_hab.csv')
## Rows: 112 Columns: 15
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (15): subjnum, exp, Habbed?, Hab1, Hab2, Hab3, Hab4, Hab5, Hab6, Hab7, H...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
skerry_2013_test_raw <- read_csv('orig_data_(1)/skerry_2013_test.csv')
## New names:
## Rows: 118 Columns: 42
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (3): mittencond, eorder, expOrcontrol dbl (37): subjnum, exp, fexp, age, male?,
## subjin, efirst, habbed?, E1, U1, E... lgl (2): bday, tday
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `avgE` -> `avgE...20`
## • `avgU` -> `avgU...21`
## • `` -> `...22`
## • `` -> `...23`
## • `` -> `...24`
## • `` -> `...25`
## • `` -> `...26`
## • `` -> `...29`
## • `avgE` -> `avgE...36`
## • `avgU` -> `avgU...37`
## • `` -> `...38`
## • `` -> `...39`
## • `` -> `...40`
## • `` -> `...41`
## • `` -> `...42`
skerry_2013_fixed <- left_join(skerry_2013_hab_raw, skerry_2013_test_raw, by = c("subjnum" = "subjnum", "exp" = "exp"))

write.csv(skerry_2013_fixed,"orig_data_cleaned_(2)/skerry_2013.csv", row.names = FALSE)

3.20.2 Common format

skerry_2013_fixed <- read_csv('orig_data_cleaned_(2)/skerry_2013.csv')
## New names:
## Rows: 112 Columns: 55
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (3): mittencond, eorder, expOrcontrol dbl (50): subjnum, exp, Habbed?, Hab1,
## Hab2, Hab3, Hab4, Hab5, Hab6, Hab7, H... lgl (2): bday, tday
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `avgE...20` -> `avgE...33`
## • `avgU...21` -> `avgU...34`
## • `...22` -> `...35`
## • `...23` -> `...36`
## • `...24` -> `...37`
## • `...25` -> `...38`
## • `...26` -> `...39`
## • `...29` -> `...42`
## • `avgE...36` -> `avgE...49`
## • `avgU...37` -> `avgU...50`
## • `...38` -> `...51`
## • `...39` -> `...52`
## • `...40` -> `...53`
## • `...41` -> `...54`
## • `...42` -> `...55`
skerry_2013_common_format <- skerry_2013_fixed %>%
  mutate(paper = "skerry_2013") %>%
  mutate(subj = `subjnum`) %>%
  mutate(expt_num = fexp, expt_cond = fexp) %>%
  mutate(sex = ifelse(`male?` == 1, "M", "F")) %>%
  mutate(training_type = "hab") %>%
  mutate(agedays = age) %>%
  mutate(order = ifelse(`eorder` == "EU", "exp", "unexp")) %>%
  mutate(expected1 = E1) %>%
  mutate(unexpected1 = U1) %>%
  mutate(expected2 = E2) %>%
  mutate(unexpected2 = U2) %>%
  mutate(expected3 = E3) %>%
  mutate(unexpected3 = U3) %>%
  mutate(train1 = `Hab1`, train2 = `Hab2`, train3 = `Hab3`, train4 = `Hab4`, train5 = `Hab5`, train6 = `Hab6`, train7 = `Hab7`, train8 = `Hab8`, train9 = `Hab9`, train10 = `Hab10`, train11 = `Hab11`, train12 = `Hab12`) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(skerry_2013_common_format,"outputs_(3)/skerry_2013.csv", row.names = FALSE)

3.21 Brandone 2009

3.21.1 Rectangular Format

brandone_2009_raw <- read_sav('orig_data_(1)/brandone_2009.sav')

write.csv(brandone_2009_raw,"orig_data_cleaned_(2)/brandone_2009.csv", row.names = FALSE)

3.21.2 Common format

brandone_2009_fixed <- read_csv('orig_data_cleaned_(2)/brandone_2009.csv')
## Rows: 180 Columns: 37
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (37): Condition, Subj, AgeGroup, Age, Gender, TestOrder, HabTrials, HabY...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
brandone_2009_common_format <- brandone_2009_fixed %>%
  mutate(paper = "brandone_2009") %>%
  mutate(subj = `Subj`) %>%
  mutate(expt_num = 1, expt_cond = ifelse(Condition == 1, paste("1_successfulreaching", AgeGroup, sep = ""), ifelse(Condition == 2, paste("1_failedreaching", AgeGroup, sep = ""), paste("1_control", AgeGroup, sep = "")))) %>%
  mutate(sex = Gender) %>%
  mutate(training_type = "hab") %>%
  mutate(agedays = Age * 30.44) %>%
  mutate(order = ifelse(`TestOrder` == 1, "exp", "unexp")) %>%
  mutate(expected1 = DirectTest1) %>%
  mutate(unexpected1 = IndirectTest1) %>%
  mutate(expected2 = DirectTest2) %>%
  mutate(unexpected2 = IndirectTest2) %>%
  mutate(expected3 = DirectTest3) %>%
  mutate(unexpected3 = IndirectTest3) %>%
  mutate(train1 = `hab1`, train2 = `hab2`, train3 = `hab3`, train4 = `hab4`, train5 = `hab5`, train6 = `hab6`, train7 = `hab7`, train8 = `hab8`, train9 = `hab9`, train10 = `hab10`) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(brandone_2009_common_format,"outputs_(3)/brandone_2009.csv", row.names = FALSE)

3.22 Liu unpublished B (Goal Simple)

3.22.1 Rectangular format

liu_unpublishedb_raw <- read_csv('orig_data_(1)/liu_unpublishedb_lookingtime.csv')
## Rows: 311 Columns: 11
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (5): SubjectInfo.study, SubjectInfo.subjID, SubjectInfo.date_of_test, Tr...
## dbl (5): SubjectInfo.sessionNumber, SubjectInfo.condition, Trials.ordinal, T...
## lgl (1): Trials.excludeTrial
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
liu_unpublishedb_participant <- read_csv('orig_data_(1)/liu_unpublishedb_participant_log.csv')
## New names:
## Rows: 892 Columns: 39
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (31): subjID_long, subjID, include_session_individual_differences, inclu... dbl
## (1): session_number lgl (7): exclude_individual_explanation,
## include_session_group_analysis...6...
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `include_session_group_analysis` -> `include_session_group_analysis...6`
## • `include_session_group_analysis` -> `include_session_group_analysis...7`
## • `` -> `...35`
## • `` -> `...36`
## • `` -> `...37`
## • `` -> `...38`
## • `` -> `...39`
liu_unpublishedb_looks <- liu_unpublishedb_raw %>%
  filter(Trials.excludeTrial == "FALSE")%>%
  dplyr::select(SubjectInfo.subjID, Trials.trialType, Looks.duration_onLooks)%>%
  pivot_wider(names_from = "Trials.trialType", values_from = "Looks.duration_onLooks") %>%
  dplyr::select(-contains("DNI"))

liu_unpublishedb_log <- liu_unpublishedb_participant %>%
  filter(is.na(exclude_group_explanation), subjID != "shorter version") %>%
  mutate(order = ifelse(condition == 1|condition == 2, "unexp", "exp")) %>%
  dplyr::select(subjID, sex_gender, agedays, order)

liu_unpublishedb_fixed <- left_join(liu_unpublishedb_log, liu_unpublishedb_looks, by = c("subjID" = "SubjectInfo.subjID"))

write.csv(liu_unpublishedb_fixed,"orig_data_cleaned_(2)/liu_unpublishedb.csv", row.names = FALSE)

3.22.2 Common format

liu_unpublishedb_common_format <- liu_unpublishedb_fixed %>%
  mutate(subj = subjID)%>%
  mutate(sex = sex_gender) %>%
  mutate(paper = "liu_unpublishedb") %>%
  mutate(expt_num = 1, expt_cond = 1) %>%
  mutate(training_type = "fam") %>%
  mutate(expected1 = ifelse(order == "exp", test1, test2)) %>%
  mutate(unexpected1 = ifelse(order == "unexp", test1, test2)) %>%
  mutate(expected2 = ifelse(order == "exp", test4, test3)) %>%
  mutate(unexpected2 = ifelse(order == "unexp", test4, test3)) %>%
  mutate(train1 = fam1, train2 = fam2, train3 = fam3, train4 = fam4, train5 = fam5, train6 = fam6) %>%
  dplyr::select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(liu_unpublishedb_common_format,"outputs_(3)/liu_unpublishedb.csv", row.names = FALSE)

3.23 Stojnic 2023

3.23.1 Rectangular Format

stojnic_underrevision_exp1_raw <- read_csv('orig_data_(1)/stojnic_underrevision/Experiment1/omnibus_long.csv')
## Rows: 480 Columns: 7
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (4): Participant, Gender, TrialType, Task
## dbl (3): TrrialType, Trial, Looking
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
stojnic_underrevision_exp2_raw <- read_csv('orig_data_(1)/stojnic_underrevision/Experiment2/omnibus_long.csv')
## Rows: 2880 Columns: 7
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (4): Subject, Gender, Task, TrialType
## dbl (3): Months, Trial, Looking
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
stojnic_underrevision_exp1_fixed <- stojnic_underrevision_exp1_raw %>%
  mutate(expt_num = 1, expt_cond = paste(1, ifelse(Task == "Efficient-Agent", "_efficientagent", "_goaldirected"))) %>%
  mutate(trial_sum = ifelse(TrialType=="Familiarization", paste("fam", Trial, sep = ""), ifelse(TrialType == "Test_Expected", "expected1", "unexpected1")))

stojnic_get_order_exp1 <- stojnic_underrevision_exp1_fixed %>%
  select(expt_cond, Participant, Trial, TrialType) %>%
  pivot_wider(names_from = "Trial", values_from = "TrialType") %>%
  mutate(order = ifelse(`9` == "Test_Expected", "exp", "unexp")) %>%
  select(expt_cond, Participant, order)

stojnic_underrevision_exp1_final <- left_join(stojnic_underrevision_exp1_fixed, stojnic_get_order_exp1, by = c("expt_cond" = "expt_cond", "Participant" = "Participant")) %>%
  mutate(Subject = Participant) %>%
  mutate(aged = TrrialType * 30.44) %>%
  select(expt_num, expt_cond, Subject, aged, trial_sum, Looking, order, Gender) %>%
  pivot_wider(names_from = "trial_sum", values_from = "Looking")

stojnic_underrevision_exp2_fixed <- stojnic_underrevision_exp2_raw %>%
  mutate(expt_num = 2, expt_cond = paste(2, ifelse(Task == "Efficient-Agent", "_efficientagent", ifelse(Task == "Inefficient-Agent", "_inefficientagent", ifelse(Task == "Multi-Agent", "_multiagent", ifelse(Task == "Goal-Directed", "_goaldirected", ifelse(Task == "Instrumental-Action", "_instrumentalaction", "_inaccessiblegoal"))))))) %>%
  mutate(trial_sum = ifelse(TrialType=="Familiarization", paste("fam", Trial, sep = ""), ifelse(TrialType == "Test_Expected", "expected1", "unexpected1")))

stojnic_get_order_exp2 <- stojnic_underrevision_exp2_fixed %>%
  select(expt_cond, Subject, Trial, TrialType) %>%
  pivot_wider(names_from = "Trial", values_from = "TrialType") %>%
  mutate(order = ifelse(`9` == "Test_Expected", "exp", "unexp")) %>%
  select(expt_cond, Subject, order)

stojnic_underrevision_exp2_final <- left_join(stojnic_underrevision_exp2_fixed, stojnic_get_order_exp2, by = c("expt_cond" = "expt_cond", "Subject" = "Subject")) %>%
  mutate(aged = Months * 30.44) %>%
  select(expt_num, expt_cond, Subject, aged, trial_sum, Looking, order, Gender) %>%
  pivot_wider(names_from = "trial_sum", values_from = "Looking")


stojnic_underrevision_fixed <- rbind(stojnic_underrevision_exp1_final, stojnic_underrevision_exp2_final)

write.csv(stojnic_underrevision_fixed,"orig_data_cleaned_(2)/stojnic_underrevision.csv", row.names = FALSE)

3.23.2 Common format

stojnic_underrevision_common_format <- stojnic_underrevision_fixed %>%
  mutate(agedays = aged) %>%
  mutate(paper = "stojnic_2023") %>%
  mutate(training_type = "fam") %>%
  mutate(train1 = fam1, train2 = fam2, train3 = fam3, train4 = fam4, train5 = fam5, train6 = fam6, train7 = fam7, train8 = fam8) %>%
  mutate(subj = Subject, sex = Gender) %>%
  select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(stojnic_underrevision_common_format,"outputs_(3)/stojnic_2023.csv", row.names = FALSE)

3.24 Sanal-Hayes 2022

3.24.1 Common format

sanalhayes_2022_fixed <- read_csv('orig_data_cleaned_(2)/sanal-hayes_2022.csv')
## Rows: 16 Columns: 10
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (10): subj, Groups, LOGHAB10, LOGHAB9, LOGHAB8, LOGHAB7, LOGBIGCOG, LOGB...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
sanalhayes_2022_common_format <- sanalhayes_2022_fixed %>%
  mutate(paper = "sanal-hayes_2022") %>%
  mutate(expt_num = 2, expt_cond = ifelse(Groups == 1| Groups == 3, "2_large", "2_small")) %>%
  mutate(order = ifelse(Groups ==1 | Groups == 4, "exp", "unexp")) %>%
  mutate(training_type = "hab") %>%
  mutate(expected1 = ifelse(Groups == 1| Groups == 3, exp(LOGBIGCOG), exp(LOGSMALLCOG))) %>%
  mutate(unexpected1 = ifelse(Groups == 1| Groups == 3, exp(LOGBIGINCOG), exp(LOGSMALLINCOG))) %>%
  mutate(train1 = exp(LOGHAB7), train2 = exp(LOGHAB8), train3 = exp(LOGHAB9), train4 = exp(LOGHAB10)) %>%
  select(paper, expt_num, expt_cond, subj, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(sanalhayes_2022_common_format,"outputs_(3)/sanal-hayes_2022.csv", row.names = FALSE)

3.25 Liu unpublished A (PHYS)

3.25.1 Rectangular format

liu_unpublisheda_raw <- read_csv('orig_data_(1)/liu_unpublisheda_looking_time.csv')
## Rows: 455 Columns: 11
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (6): SubjectInfo.study, SubjectInfo.subjID, SubjectInfo.condition, Subje...
## dbl (4): SubjectInfo.sessionNumber, Trials.ordinal, Trials.duration, Looks.d...
## lgl (1): Trials.excludeTrial
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
liu_unpublisheda_participant <- read_csv('orig_data_(1)/liu_unpublisheda_study_log.csv')
## New names:
## Rows: 956 Columns: 34
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (28): subjID_long, subjID, session_number, include_session_individual_di... lgl
## (6): ...29, ...30, ...31, ...32, ...33, ...34
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...29`
## • `` -> `...30`
## • `` -> `...31`
## • `` -> `...32`
## • `` -> `...33`
## • `` -> `...34`
liu_unpublisheda_looks <- liu_unpublisheda_raw %>%
  filter(Trials.excludeTrial == "FALSE") %>%
  dplyr::select(SubjectInfo.subjID, SubjectInfo.condition, `Trials.fam# test# cal-short cal-long`, Looks.duration_onLooks) %>%
  pivot_wider(names_from = "Trials.fam# test# cal-short cal-long", values_from = "Looks.duration_onLooks") %>%
  dplyr::select(-contains("DNI"))

liu_unpublisheda_log <- liu_unpublisheda_participant %>%
  filter(include_session_group_analysis == "yes", subjID != "shorter version") %>%
  mutate(order = ifelse(condition == 1, "exp", "unexp")) %>%
  dplyr::select(subjID, sex_gender, agedays, order, task)

solidity <- left_join(liu_unpublisheda_log%>%filter(task == "solidity"), liu_unpublisheda_looks%>%filter(SubjectInfo.condition == "solidity1"|SubjectInfo.condition == "solidity2"), by = c("subjID" = "SubjectInfo.subjID"))

support <- left_join(liu_unpublisheda_log%>%filter(task == "support"), liu_unpublisheda_looks%>%filter(SubjectInfo.condition == "support1"|SubjectInfo.condition == "support2"), by = c("subjID" = "SubjectInfo.subjID"))

liu_unpublisheda_fixed <- rbind(solidity, support)

write.csv(liu_unpublisheda_fixed,"orig_data_cleaned_(2)/liu_unpublisheda.csv", row.names = FALSE)

3.25.2 Common format

liu_unpublisheda_common_format <- liu_unpublisheda_fixed %>%
  mutate(subj = subjID)%>%
  mutate(sex = sex_gender) %>%
  mutate(paper = "liu_unpublisheda") %>%
  mutate(expt_num = 1, expt_cond = paste("1_", task)) %>%
  mutate(training_type = "fam") %>%
  mutate(expected1 = ifelse(order == "exp", test1, test2)) %>%
  mutate(unexpected1 = ifelse(order == "unexp", test1, test2)) %>%
  mutate(expected2 = ifelse(order == "exp", test4, test3)) %>%
  mutate(unexpected2 = ifelse(order == "unexp", test4, test3)) %>%
  mutate(train6 = fam6) %>%
  dplyr::select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(liu_unpublisheda_common_format,"outputs_(3)/liu_unpublisheda.csv", row.names = FALSE)

3.26 Liu unpublished C (KSR)

3.26.1 Rectangular format

liu_unpublishedc_raw <- read_csv('orig_data_(1)/liu_unpublishedc_results_deid.csv')
## Rows: 623 Columns: 14
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (8): videofile, trial_type, ball_movement_direction, test_type, subject_...
## dbl (6): counterbalance, looking_time, trial_number, age_days, test_trial_n,...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
liu_unpublishedc_fixed <- liu_unpublishedc_raw %>%
  filter(part_1_or_2 == 1) %>%
  mutate(trial_info = ifelse(trial_type == "hab", paste(trial_type, trial_number, sep = "_"), ifelse(test_trial_n == 1 | test_trial_n ==2, paste(test_type, 1, sep = "_"), ifelse(test_trial_n == 3 | test_trial_n ==4, paste(test_type, 2, sep = "_"), paste(test_type, 3, sep = "_"))))) %>%
  mutate(looking_time = as.numeric(looking_time)/1000) %>%
  mutate(order = ifelse(counterbalance == 2, "exp", "unexp")) %>%
  dplyr::select(subject_ID, trial_info, sex, age_days, looking_time, order) %>%
  pivot_wider(names_from = "trial_info", values_from = "looking_time")

write.csv(liu_unpublishedc_fixed,"orig_data_cleaned_(2)/liu_unpublishedc.csv", row.names = FALSE)

3.26.2 Common format

liu_unpublishedc_common_format <- liu_unpublishedc_fixed %>%
  mutate(subj = subject_ID)%>%
  mutate(paper = "liu_unpublishedc") %>%
  mutate(agedays = age_days) %>%
  mutate(expt_num = 1, expt_cond = 1) %>%
  mutate(training_type = "hab") %>%
  mutate(expected1 = exp_1) %>%
  mutate(unexpected1 = unexp_1) %>%
  mutate(expected2 = exp_2) %>%
  mutate(unexpected2 = unexp_2) %>%
  mutate(expected3 = exp_3) %>%
  mutate(unexpected3 = unexp_3) %>%
  mutate(train1 = hab_1, train2 = hab_2, train3 = hab_3, train4 = hab_4, train5 = hab_5, train6 = hab_6, train7 = hab_7, train8 = hab_8, train9 = hab_9, train10 = hab_10, train11 = hab_11, train12 = hab_12, train13 = hab_13, train14 = hab_14) %>%
  dplyr::select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(liu_unpublishedc_common_format,"outputs_(3)/liu_unpublishedc.csv", row.names = FALSE)

3.27 Liu unpublished D (KSR zoom)

3.27.1 Rectangular format

liu_unpublishedd_raw <- read_csv('orig_data_(1)/liu_unpublishedd.csv') %>% filter(study == "KSR-Z")
## Rows: 971 Columns: 19
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (11): lab_chs, study, test_setup, first_study, unique_subj, sex, first.t...
## dbl  (8): highchair, repeat., include, agem, final_exclude, online_look, off...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
liu_unpublishedd_fixed <- liu_unpublishedd_raw %>%
  dplyr::select(unique_subj, sex, agem, first.test, trial, look)%>%
  pivot_wider(names_from = "trial", values_from = "look")
## Warning: Values from `look` are not uniquely identified; output will contain list-cols.
## • Use `values_fn = list` to suppress this warning.
## • Use `values_fn = {summary_fun}` to summarise duplicates.
## • Use the following dplyr code to identify duplicates.
##   {data} %>%
##   dplyr::group_by(unique_subj, sex, agem, first.test, trial) %>%
##   dplyr::summarise(n = dplyr::n(), .groups = "drop") %>%
##   dplyr::filter(n > 1L)
liu_unpublishedd_fixed$fam1 <-as.numeric(liu_unpublishedd_fixed$fam1)
liu_unpublishedd_fixed$fam2 <-as.numeric(liu_unpublishedd_fixed$fam2)
liu_unpublishedd_fixed$fam3 <-as.numeric(liu_unpublishedd_fixed$fam3)
liu_unpublishedd_fixed$fam4 <-as.numeric(as.character(liu_unpublishedd_fixed$fam4))
## Warning: NAs introduced by coercion
liu_unpublishedd_fixed$fam5 <-as.numeric(liu_unpublishedd_fixed$fam5)
liu_unpublishedd_fixed$fam6 <-as.numeric(liu_unpublishedd_fixed$fam6)
liu_unpublishedd_fixed$test1 <-as.numeric(liu_unpublishedd_fixed$test1)
liu_unpublishedd_fixed$test2 <-as.numeric(liu_unpublishedd_fixed$test2)
liu_unpublishedd_fixed$test3 <-as.numeric(liu_unpublishedd_fixed$test3)
liu_unpublishedd_fixed$test4 <-as.numeric(liu_unpublishedd_fixed$test4)

write.csv(liu_unpublishedd_fixed,"orig_data_cleaned_(2)/liu_unpublishedd.csv", row.names = FALSE)

3.27.2 Common format

liu_unpublishedd_common_format <- liu_unpublishedd_fixed %>%
  mutate(subj = unique_subj) %>%
  mutate(agedays = agem * 30.44) %>%
  mutate(paper = "liu_unpublishedd") %>%
  mutate(expt_num = 1, expt_cond = 1) %>%
  mutate(order = first.test) %>%
  mutate(training_type = "fam") %>%
  mutate(expected1 = ifelse(order == "exp", test1, test2)) %>%
  mutate(unexpected1 = ifelse(order == "unexp", test1, test2)) %>%
  mutate(expected2 = ifelse(order == "exp", test3, test4)) %>%
  mutate(unexpected2 = ifelse(order == "unexp", test3, test4)) %>%
  mutate(train1 = fam1, train2 = fam2, train3 = fam3, train4 = fam4, train5 = fam5, train6 = fam6) %>%
  dplyr::select(paper, expt_num, expt_cond, subj, sex, agedays, training_type, order, starts_with("train"), starts_with("expected"), starts_with("unexpected"))

write.csv(liu_unpublishedd_common_format,"outputs_(3)/liu_unpublishedd.csv", row.names = FALSE)