joaquinanguera / aceR

An R package for processing ACE data
MIT License
3 stars 14 forks source link

Subscript out of bounds error #55

Open joshvolponi opened 1 month ago

joshvolponi commented 1 month ago

When processing some aceR data, a coordinator is getting a "subscript out of bounds" output error. When they download the demographics file from the Nexus website, it lists fewer participants than participants that they have data on. This error came from the "proc_ace_complete" function, but it occurred with several others after the fact as well. acersubscripterror

arjunpur commented 3 weeks ago

I am able to reproduce this on a basic run on just SPATIALSPAN. I suspect the issue is we haven't loaded in the DEMOGRAPHICS column and the following code assumes that the column exists: ~df$data[df$module == DEMOS][[1]] - resulting in an index out of bounds error.

> devtools::load_all("~/Projects/neuroscape/aceR")
ℹ Loading aceR
> path=("/Users/arjun/Projects/neuroscape/aceR/ignore/data/data_path")
> ace_data=proc_ace_complete(path, data_type="explorer")
Starting  /Users/arjun/Projects/neuroscape/aceR/ignore/data/data_path/SPATIALSPAN.csv 
Finished! See possible warnings below.
Data loaded in from CSVs
Trials with RT < 200 ms NA'd out
Error in `mutate()`:
ℹ In argument: `demos = map(1:n(), ~df$data[df$module == DEMOS][[1]])`.
Caused by error in `map()`:
ℹ In index: 1.
Caused by error in `df$data[df$module == DEMOS][[1]]`:
! subscript out of bounds

Browse[1]> df$data[df$module == DEMOS][[1]]
Error in df$data[df$module == DEMOS][[1]] : subscript out of bounds
Browse[1]> DEMOS
[1] "DEMOGRAPHICS"
Browse[1]> df$module
[1] "SPATIALSPAN"
Browse[1]> names(df)
[1] "module" "data"  
arjunpur commented 3 weeks ago

However, when I add in the demographics.csv file to the directory with SPATIALSPAN.csv, I end up getting the following error which is tracked in this other Github issue: https://github.com/joaquinanguera/aceR/issues/51.

Browse[1]> ace_data=proc_ace_complete(path, data_type="explorer")
Starting  /Users/arjun/Projects/neuroscape/aceR/ignore/data/data_path/demographics.csv 
Error in if (mask$get_size() > 0) { : argument is of length zero