Extract donor-recipient couples from an epidemic

extractDRCouples(epidemic, ids = NULL, sampledOnly = TRUE,
  activeOnly = FALSE, tMin = 0, tMax = Inf, firstN = Inf, lastN = Inf)

Arguments

epidemic

a list representing an epidemic (as returned by simulateEpidemic)

ids

integer vector or NULL, specifying the id of individuals in epidemic$gen to be extracted

sampledOnly

a logical indicating whether only recovered individuals should be extracted

activeOnly

a logical indicating whether only currently infected and alive individuals should be extracted

tMin, tMax

a numericals indicating the interval of observation times for extracted individuals. If sampledOnly is TRUE the observation time is the time of sampling (recovery), otherwise it is the time of infection. Default: tMin=0, tMax=Inf.

firstN

integer indicating whether to return only the first firstN observed individuals (default is Inf)

lastN

integer indicating whether to return only the most recently observed lastN individuals (default is Inf). This filter is applied after the previous filters.

Value

a data.table with rows corresponding to the extracted couples with the following columns:

idD: id of the donor id: id of the recipient envd: environment type of the donor gd: transmitted strain from the donor to the recipient ed: donor special environmental effect at the moment of transmission env: environment type of the recipient gene: strain in the recipient at the moment of sampling or at the current moment e: special environmental effects of the recipient tauR: age of infection in the recipient (in timeStep units) tauDAtInf: age of infection in the donor at the moment of transmission (in timeStep units) tauD: time (in timeStep units) in the donor from the moment of transmission until the moment of sampling or the current moment taum: =tauD+tauR eD: special environmental effect in the donor at the moment of sampling gD: strain in the donor at the moment of sampling