getCastePop {SIMplyBee} | R Documentation |
Access individuals of a caste
Description
Level 1 function that returns individuals of a caste. These
individuals stay in the colony (compared to pullCastePop
).
Usage
getCastePop(
x,
caste = "all",
nInd = NULL,
use = "rand",
removeFathers = TRUE,
collapse = FALSE
)
getQueen(x, collapse = FALSE)
getFathers(x, nInd = NULL, use = "rand", collapse = FALSE)
getWorkers(x, nInd = NULL, use = "rand", collapse = FALSE)
getDrones(x, nInd = NULL, use = "rand", removeFathers = TRUE, collapse = FALSE)
getVirginQueens(x, nInd = NULL, use = "rand", collapse = FALSE)
Arguments
x |
|
caste |
character, "queen", "fathers", "workers", "drones", "virginQueens", or "all" |
nInd |
numeric, number of individuals to access, if |
use |
character, all options provided by |
removeFathers |
logical, removes |
collapse |
logical, whether to return a single merged population |
Value
when x
is Colony-class
return is
Pop-class
for caste != "all"
or list for caste
== "all"
with nodes named by caste; when x
is
MultiColony-class
return is a named list of
Pop-class
for caste != "all"
or named list of lists of
Pop-class
for caste == "all"
. You can merge
all the populations in the list with mergePops
function.
Functions
-
getQueen()
: Access the queen -
getFathers()
: Access fathers (drones the queen mated with) -
getWorkers()
: Access workers -
getDrones()
: Access drones -
getVirginQueens()
: Access virgin queens
See Also
getQueen
, getFathers
,
getVirginQueens
, getWorkers
, and
getDrones
getCasteId
and getCaste
Examples
founderGenomes <- quickHaplo(nInd = 8, nChr = 1, segSites = 100)
SP <- SimParamBee$new(founderGenomes)
basePop <- createVirginQueens(founderGenomes)
drones <- createDrones(x = basePop[1], nInd = 1000)
droneGroups <- pullDroneGroupsFromDCA(drones, n = 10, nDrones = nFathersPoisson)
# Create a Colony and a MultiColony class
colony <- createColony(x = basePop[2])
colony <- cross(colony, drones = droneGroups[[1]])
apiary <- createMultiColony(basePop[3:4], n = 2)
apiary <- cross(apiary, drones = droneGroups[c(2, 3)])
# Build-up and add virgin queens
colony <- buildUp(x = colony)
apiary <- buildUp(x = apiary)
colony <- addVirginQueens(x = colony)
apiary <- addVirginQueens(x = apiary)
# Get the queen of the colony
getCastePop(colony, caste = "queen")
getQueen(colony)
# Comparison of getCastePop() and getWorkers()
getCastePop(colony, caste = "workers")
getCastePop(colony, caste = "workers")
getCastePop(colony, caste = "workers", nInd = 2)
# Or aliases
getWorkers(colony)
# Same aliases exist for all the castes!
# Input is a MultiColony class - same behaviour as for the Colony!
getCastePop(apiary, caste = "queen")
# Or alias
getQueen(apiary)
# Sample individuals from all the castes
getCastePop(colony, nInd = 5, caste = "all")
# Get different number of workers per colony
getCastePop(apiary, caste = "workers", nInd = c(10, 20))
# Or alias
getWorkers(apiary, nInd = c(10, 20))
# Obtain individuals from MultiColony as a single population
getCastePop(apiary, caste = "queen", collapse = TRUE)
getQueen(apiary, collapse = TRUE)
getWorkers(apiary, nInd = 10, collapse = TRUE)
getDrones(apiary, nInd = 3, collapse = TRUE)