This is an edge case, but where all subject IDs are numeric then those with leading zeros will be changed when imported with import_scn.
For example "0506" becomes "506" because fread guesses whether columns are numeric or not based on their content. Character output is guaranteed because of as.character, but if there are leading zeros then as.character(as.numeric(x)) != as.character(x).
I have a relatively simple fix, so simple I've not bothered with a PR - happy to do so if it helps.
If you add the argument colClasses=list(character = 1) to the calls to fread (within update_fs_names) then column 1 will always be read in as a character by data.table.
This should have no side effects as types for all other columns will be unaffected and column 1 is specified to be the freesurfer Study.ID
This is an edge case, but where all subject IDs are numeric then those with leading zeros will be changed when imported with
import_scn
.For example
"0506"
becomes"506"
because fread guesses whether columns are numeric or not based on their content. Character output is guaranteed because ofas.character
, but if there are leading zeros thenas.character(as.numeric(x)) != as.character(x)
.I have a relatively simple fix, so simple I've not bothered with a PR - happy to do so if it helps. If you add the argument
colClasses=list(character = 1)
to the calls to fread (withinupdate_fs_names
) then column 1 will always be read in as a character by data.table.This should have no side effects as types for all other columns will be unaffected and column 1 is specified to be the freesurfer Study.ID