Level 2 function that supersedes a Colony or MultiColony object - an event where the queen dies. The workers and drones stay unchanged, but workers raise virgin queens, of which only one prevails.

supersede(x, year = NULL, nVirginQueens = NULL, simParamBee = NULL, ...)

Arguments

x

Colony-class or MultiColony-class

year

numeric, year of birth for virgin queens

nVirginQueens

integer, the number of virgin queens to be created in the colony; of these one is randomly selected as the new virgin queen of the remnant colony. If NULL, the value from simParamBee$nVirginQueens is used

simParamBee

SimParamBee, global simulation parameters

...

additional arguments passed to nVirginQueens when this argument is a function

Value

Colony-class or MultiColony-class with the supersede event set to TRUE

Examples

founderGenomes <- quickHaplo(nInd = 10, nChr = 1, segSites = 50)
SP <- SimParamBee$new(founderGenomes)
basePop <- createVirginQueens(founderGenomes)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
drones <- createDrones(basePop[1], n = 1000)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
droneGroups <- pullDroneGroupsFromDCA(drones, n = 10, nDrones = 10)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Create 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
(colony <- buildUp(colony, nWorkers = 100))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- createMultiColony(basePop[3:8], n = 6)
#> Error in createMultiColony(basePop[3:8], n = 6): object 'basePop' not found
apiary <- cross(apiary, drones = droneGroups[2:7])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- buildUp(apiary, nWorkers = 100)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Supersede a colony
isQueenPresent(colony)
#> Error in is(x, class2 = "Colony"): object 'colony' not found
isVirginQueensPresent(colony)
#> Error in is(x, class2 = "Colony"): object 'colony' not found
colony <- supersede(colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
isQueenPresent(colony)
#> Error in is(x, class2 = "Colony"): object 'colony' not found
isVirginQueensPresent(colony)
#> Error in is(x, class2 = "Colony"): object 'colony' not found

# Supersede all colonies in the apiary
isQueenPresent(colony)
#> Error in is(x, class2 = "Colony"): object 'colony' not found
isVirginQueensPresent(colony)
#> Error in is(x, class2 = "Colony"): object 'colony' not found
apiary1 <- supersede(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
isQueenPresent(colony)
#> Error in is(x, class2 = "Colony"): object 'colony' not found
isVirginQueensPresent(colony)
#> Error in is(x, class2 = "Colony"): object 'colony' not found

# Sample colonies from the apiary that will supersede (sample with probability of 0.2)
tmp <- pullColonies(apiary, p = 0.2)
#> Error in is(x, class2 = "MultiColony"): object 'apiary' not found
# Swarm only the pulled colonies
(supersede(tmp$pulled))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found