pullCastePop {SIMplyBee}R Documentation

Pull individuals from a caste in a colony

Description

Level 1 function that pulls individuals from a caste in a colony. These individuals are removed from the colony (compared to getCaste).

Usage

pullCastePop(
  x,
  caste,
  nInd = NULL,
  use = "rand",
  removeFathers = TRUE,
  collapse = FALSE
)

pullQueen(x, collapse = FALSE)

pullWorkers(x, nInd = NULL, use = "rand", collapse = FALSE)

pullDrones(
  x,
  nInd = NULL,
  use = "rand",
  removeFathers = TRUE,
  collapse = FALSE
)

pullVirginQueens(x, nInd = NULL, use = "rand", collapse = FALSE)

Arguments

x

Colony-class or MultiColony-class

caste

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

nInd

numeric, number of individuals to pull, if NULL all individuals are pulled. 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 applied to all the colonies.

use

character, all options provided by selectInd

removeFathers

logical, removes drones that have already mated; set to FALSE if you would like to get drones for mating with multiple virgin queens, say via insemination

collapse

logical, whether to return a single merged population for the pulled individuals (does not affect the remnant colonies)

Value

list of Pop-class and Colony-class when x is Colony-class and list of (a list of Pop-class named by colony id) and MultiColony-class when x is MultiColony-class

Functions

See Also

pullQueen, pullVirginQueens, pullWorkers, and pullDrones

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]])
colony <- buildUp(x = colony, nWorkers = 100, nDrones = 10, exact = TRUE)
colony <- addVirginQueens(x = colony, nInd = 3)

apiary <- createMultiColony(basePop[3:4], n = 2)
apiary <- cross(apiary, drones = droneGroups[c(2, 3)])
apiary <- buildUp(x = apiary, nWorkers = 100, nDrones = 10, exact = TRUE)
apiary <- addVirginQueens(x = apiary, nInd = 3)

# pullCastePop on Colony class
# We can't pull the queen and leave the colony queenless
pullCastePop(colony, caste = "virginQueens")
pullCastePop(colony, caste = "virginQueens", nInd = 2)
# Or use aliases
pullVirginQueens(colony)
pullVirginQueens(colony, nInd = 2)
# Same aliases exist for all the castes!!!

# pullCastePop on MultiColony class - same behaviour as for the Colony!
pullCastePop(apiary, caste = "workers")
# Or pull out unequal number of workers from colonies
pullCastePop(apiary, caste = "workers", nInd = c(10, 20))
pullWorkers(apiary)
nWorkers(apiary)
nWorkers(pullWorkers(apiary)$remnant)


# Merge all the pulled populations into a single population
pullCastePop(apiary, caste = "queen", collapse = TRUE)
pullCastePop(apiary, caste = "virginQueens", collapse = TRUE)

[Package SIMplyBee version 0.3.0 Index]