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
)

Arguments

inpref

Prefix of the PLINK input files

outpref

Prefix of the PLINK output files

inds

Individuals which should be extracted

pops

Populations which should be extracted. Can not be provided together with inds

overwrite

Set this to TRUE if inpref == outpref and you really want to overwrite the input files.

verbose

Print progress updates