addCastePop {SIMplyBee}R Documentation

Add caste individuals to the colony

Description

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.

Usage

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,
  ...
)

Arguments

x

Colony-class or MultiColony-class

caste

character, "workers", "drones", or "virginQueens"

nInd

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.

new

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

exact

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)

year

numeric, only relevant when adding virgin queens - year of birth for virgin queens

simParamBee

SimParamBee, global simulation parameters

...

additional arguments passed to nInd when this argument is a function

Details

This function increases queen's nWorkers and nHomBrood counters.

Value

Colony-class or MultiColony-class with workers added

Functions

Examples

founderGenomes <- quickHaplo(nInd = 5, nChr = 1, segSites = 50)
SP <- SimParamBee$new(founderGenomes)
basePop <- createVirginQueens(founderGenomes)

drones <- createDrones(x = basePop[1], nInd = 100)
droneGroups <- pullDroneGroupsFromDCA(drones, n = 5, nDrones = nFathersPoisson)

# Create and cross Colony and MultiColony class
colony <- createColony(x = basePop[2])
colony <- cross(colony, drones = droneGroups[[1]])
apiary <- createMultiColony(basePop[4:5], n = 2)
apiary <- cross(apiary, drones = droneGroups[3:4])

#Here we show an example for workers, but same holds for drones and virgin queens!
# Add workers
addCastePop(colony, caste = "workers", nInd = 20)
# Or use a alias function
addWorkers(colony, nInd = 20)
# 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))
# 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))
nWorkers(addWorkers(colony, nInd = nWorkersPoisson))
# 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))
# nVirginQueens/nWorkers/nDrones will vary between function calls when a function is used

# Queen's counters
getMisc(getQueen(addWorkers(colony)))

# Add individuals to a MultiColony object
apiary <- addWorkers(apiary)
# Add different number of workers to colonies
nWorkers(addWorkers(apiary, nInd = c(50, 100)))


[Package SIMplyBee version 0.3.0 Index]