R/RcppExports.R

# This file was generated by Rcpp::compileAttributes
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' @title  Simulate the progeny
#'
#' @description Simulates the progeny for a given breeding pair, to a specified litter size
#'
#' @param pair A vector of alleles, of length 2.
#' Alleles must be represented as 0, 1 or 2.
#' @param litter The litter size from the breeding pair.
#'
#' @return The alleles of progeny, also using the 0, 1 or 2 representation
#'
#' @examples
#' breed(c(1, 1), litter = 6)
#'
#' # Sampling a population
#' pop <-matrix(sample(c(0, 1, 2), 10, TRUE), ncol = 2)
#' progeny <- apply(pop, 1, breed, litter = 6)
#' @export
breed <- function(pair, litter) {
    .Call('driftSim_breed', PACKAGE = 'driftSim', pair, litter)
}

#' @title  Simulate the progeny
#'
#' @description Simulates the progeny for a set of breeding pairs, to a specified litter size
#'
#' @param pairs A two-column matrix of alleles.
#' Alleles must be represented as 0, 1 or 2.
#' @param litter The litter size from the breeding pair.
#'
#' @return The alleles of progeny, also using the 0, 1 or 2 representation. Returned as a vector
#'
#' @examples
#' breed(c(1, 1), litter = 6)
#'
#' # Sampling a population
#' pop <-matrix(sample(c(0, 1, 2), 10, TRUE), ncol = 2)
#' apply(pop, 1, breed, litter = 6)
#' breedInPairs(pop, litter = 6)
#' @export
breedInPairs <- function(pairs, litter) {
    .Call('driftSim_breedInPairs', PACKAGE = 'driftSim', pairs, litter)
}

#' @title Set migration Probabilities
#'
#' @description Defines the migration rate using a radial model with Pop1 as the central population.
#' All others form a ring aorund this population.
#'
#' @param n The number of populations
#' @param mig The migration rate
#'
#' @return A matrix with migration probabilities
#'
#' @examples
#' setMigProbs(6, 0.1)
#' @export
setMigProbs <- function(n, mig) {
    .Call('driftSim_setMigProbs', PACKAGE = 'driftSim', n, mig)
}
steveped/driftSim documentation built on May 30, 2019, 5:38 p.m.