Computing f2 statistics for populations consisting of many individuals can be slow and require a lot of memory.
To speed this up, this function groups individuals into populations, computes allele counts and products of
pairwise allele counts with all individuals and groups, and writes the data to disk. f2 statistics for a
combination of grouped and ungrouped precomputed data can then be read using f2_from_precomp
,
replacing individual IDs of the grouped samples with the new group labels.
All groupings are listed in {dir}/groups/{groupname}.rds
group_samples(dir, inds, pops, overwrite = FALSE, verbose = TRUE)
Directory with precomputed individual pair data
Individuals to group
Group names, either length 1, or same length as inds
Overwrite existing files in outdir
print progress updates