genepop_sample: Randomly sample individuals from Genepop.

View source: R/genepop_sample.R

genepop_sampleR Documentation

Randomly sample individuals from Genepop.

Description

Stratified random sample of individuals from a Genepop file.

Usage

genepop_sample(genepop, nsample)

Arguments

genepop

the genepop data to be manipulated. This can be either a file path or a dataframe read in with tab separation, header=FALSE , quote="", and stringsAsFactors=FALSE. This will be the standard genepop format with the first n+1 rows corresponding to the n loci names, or a single comma delimited row of loci names followed by the locus data. Populations are separated by "Pop". Each individual ID is linked to the locus data by " , " (space,space space) and is read in as as a single row (character).

nsample

vector or dataframe which defines the random stratified sampling. If nsample is an integer (e.g. 5) then nsample individuals will be selected from each population. If nsample is a fraction (0-0.9) then that percentage of individuals will be selected from each population. If nsample is a dataframe then the number or fraction associated with each population will be sampled. where the first column is the population and the second is the number to be sampled.


rystanley/genepopedit documentation built on June 27, 2023, 11:33 p.m.