downsample_pairs {CKMRpop}R Documentation

downsample the number of individuals sampled

Description

This discards individuals from the sample, randomly, until the desired number of samples is achieved, then it returns only those pairs in which both members are part of the retained samples.

Usage

downsample_pairs(S, P, n)

Arguments

S

the tibble of samples with columns at least of ID and samp_years_list. Typically this will be what is returned in the samples component from slurp_spip().

P

the tibble of pairs. Typically this will be what has been returned from compile_related_pairs().

n

The desired number of individuals (or instances, really, see below) to retain in the sample.

Value

This returns a list with two components as follows:

Examples

# prepare some input
S <- three_pops_with_mig_slurped_results$samples
P <- compile_related_pairs(three_pops_with_mig_slurped_results$samples)
result <- downsample_pairs(S, P, n = 500)

# print the result
result

[Package CKMRpop version 0.1.3 Index]