This function reads PLINK files, extracts a subset of samples, and writes new PLINK files using write_plink
. It's probably slower than running the equivalent command in PLINK directly, but it can be useful to do this from within R.
When inds
or pops
is provided, only a subset of samples will be extracted.
extract_samples(
inpref,
outpref,
inds = NULL,
pops = NULL,
overwrite = FALSE,
verbose = TRUE
)
Prefix of the PLINK input files
Prefix of the PLINK output files
Individuals which should be extracted
Populations which should be extracted. Can not be provided together with inds
Set this to TRUE
if inpref == outpref
and you really want to overwrite the input files.
Print progress updates