#* SIMULATE TIME INTERVAL
#' Simulate a time interval
#'
#' Simulates the survival and reproduction of a population between two moments in time based on TPD
#'
#' @param TPD A population's thermal-performance data.
#'
#' @param Te The environmental temperature.
#'
#' @param Sp The relationship between performance and survival
#'
#' @param Rp The relationship between performance and reproduction.
#'
#' @param Mu Mutation rate
#'
#' @param Mum Mean percentage of change on a TPT due to mutation
#'
#' @param Musd SD of the percentage of change on a TPT due to mutation
#'
#' @param Degree The degree to fit the polynomial regressions relating Tm to P.
#'
#' @param Pmin The mimum performance to be considered.
#'
#' @param Samples Samples to be taken from each new individual.
#'
#' @param Error Amount of error to be introduced in offspring samples.
#'
#' @return A new TP population dataset with survivors and offspring.
#'
#' @examples
#'
#' @export
sim_time <- function(TPD, Te, Sp, Rp, Mu, Mum, Musd, Degree, Pmin, Samples, Error){
# determine survivors with sim_surv
survivors <- sim_surv(TPD = TPD, Te = Te, Sp = Sp, Degree = Degree, Pmin = Pmin)
# determine offspring with sim_repr
offspring <- sim_repr(TPD = TPD, Te = Te, Rp = Rp, Mu = Mu, Mum = Mum, Musd = Musd,
Degree = Degree, Pmin = Pmin, Samples = Samples, Error = Error)
# bind datasets together
newpop <- rbind(survivors, offspring)
# define return
return(newpop)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.