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 |
P |
the tibble of pairs. Typically this will be what has been returned from
|
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:
-
ds_samples
: A tibble likeS
except having randomly removed individuals so as to only have n left. -
ds_pairs
: A tibble likeP
except having removed any pairs that include individuals that were not retained in the sample.
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