Learn R Programming

diveRsity (version 1.9.89)

gpSampler: Randomly sample a genepop file

Description

Randomly re-samples population samples from a genepop file for user defined sizes and returns a new genepop file containing the sub-sample data. The function can easily be integrated into simulation pipelines when exploring sample size effects.

Usage

gpSampler(infile = NULL, samp_size = 10, outfile = NULL)

Arguments

infile
A character string pointing to a genepop input file. If the file exists in the current working directory, only the file name is required. If the file resides elsewhere, the entire file path is required.
samp_size
This argument specifies the number of individuals to be randomly sampled from each population sample in the input file. Either a single numeric argument can be passed or a numeric vector of length equal to the number of population samples in the genepop file.
outfile
A character string specifying the prefix name for the resulting file. This string will be suffixed with ".gen". The file will be written to the working directory, unless a properly formatted path is passed to outfile