
# Create a dataframe for selection
sel_df <- pop_df

#Select individuals using useFunc and a selection index. Note that noise is added depending on h2 (we use h2=1, so no noise is added)
DH@misc = list(smth1 = sel_df$main_effect + 
                 rnorm(nrow(sel_df), mean = 0, sd = sqrt(var(sel_df$main_effect)* (1 - h2) / h2)))

useFunc = function(DH, trait = NULL) DH@misc$smth1 
selParents = selectInd(DH, nSelParents, use = useFunc, simParam = SP)

Parents <- selParents


F1 <- randCross(Parents, nCrosses)
DH <- makeDH(F1, nDH)






