whatever can go wrong, will go wrong: R join

SNPtest requires

the sample files for each cohort have exactly the same set of covariates and phenotypes and these occur in the same order in the files

Sounds clear.
But when merging phenotypes in R using the “merge” function, the original order of ids in the first file was destroyed without notice. And SNPtest will accept a wrong order without any error message (a clear design error of SNPtest). The workaround is quite simple: Never use “merge” but “join” in R

library(plyr)
df_total <- join(df_1, df_2, type="left")