Level 2 function that adds (raises) the specified number of a specific caste individuals to a Colony or MultiColony object by producing offspring from a mated queen. If there are already some individuals present in the caste, new and present individuals are combined.
addCastePop(
x,
caste = NULL,
nInd = NULL,
new = FALSE,
exact = FALSE,
year = NULL,
simParamBee = NULL,
...
)
addWorkers(x, nInd = NULL, new = FALSE, exact = FALSE, simParamBee = NULL, ...)
addDrones(x, nInd = NULL, new = FALSE, simParamBee = NULL, ...)
addVirginQueens(
x,
nInd = NULL,
new = FALSE,
year = NULL,
simParamBee = NULL,
...
)
character, "workers", "drones", or "virginQueens"
numeric or function, number of workers to be added, but see
new
; if NULL
then SimParamBee$nWorkers
is used.
If input is MultiColony-class
,
the input could also be a vector of the same length as the number of colonies. If
a single value is provided, the same value will be used for all the colonies.
logical, should the number of individuals be added to the caste population
anew or should we only top-up the existing number of individuals to nInd
logical, only relevant when adding workers - if the csd locus is turned
on and exact is TRUE
, we add the exact specified number of viable workers
(heterozygous at the csd locus)
numeric, only relevant when adding virgin queens - year of birth for virgin queens
SimParamBee
, global simulation parameters
additional arguments passed to nInd
when this argument is a function
Colony-class
or MultiColony-class
with
workers added
This function increases queen's nWorkers
and nHomBrood
counters.
addWorkers()
: Add workers to a colony
addDrones()
: Add drones to a colony
addVirginQueens()
: Add virgin queens to a colony
founderGenomes <- quickHaplo(nInd = 5, nChr = 1, segSites = 50)
SP <- SimParamBee$new(founderGenomes)
SP$nThreads = 1L
basePop <- createVirginQueens(founderGenomes)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
drones <- createDrones(x = basePop[1], nInd = 100)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
droneGroups <- pullDroneGroupsFromDCA(drones, n = 5, nDrones = nFathersPoisson)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Create and cross Colony and MultiColony class
colony <- createColony(x = basePop[2])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
colony <- cross(colony, drones = droneGroups[[1]])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- createMultiColony(basePop[4:5], n = 2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- cross(apiary, drones = droneGroups[3:4])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
#Here we show an example for workers, but same holds for drones and virgin queens!
# Add workers
addCastePop(colony, caste = "workers", nInd = 20)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Or use a alias function
addWorkers(colony, nInd = 20)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Same aliases exist for drones and virgin queens!
# If nInd is NULL, the functions uses the default in SP$nWorkers
# We can change this default
SP$nWorkers <- 15
nWorkers(addWorkers(colony))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# nVirginQueens/nWorkers/nDrones will NOT vary between function calls when a constant is used
# Specify a function that will give a number
nWorkers(addWorkers(colony, nInd = nWorkersPoisson))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nWorkers(addWorkers(colony, nInd = nWorkersPoisson))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# nVirginQueens/nWorkers/nDrones will vary between function calls when a function is used
# Store a function or a value in the SP object
SP$nWorkers <- nWorkersPoisson
(addWorkers(colony))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# nVirginQueens/nWorkers/nDrones will vary between function calls when a function is used
# Queen's counters
getMisc(getQueen(addWorkers(colony)))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Add individuals to a MultiColony object
apiary <- addWorkers(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Add different number of workers to colonies
nWorkers(addWorkers(apiary, nInd = c(50, 100)))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found