Level 2 function that collapses a Colony or MultiColony object by setting the collapse event slot to TRUE. The production status slot is also changed (to FALSE).

collapse(x)

Value

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

Details

You should use this function in an edge-case when you want to indicate that the colony has collapsed, but you still want to collect some values from the colony for a retrospective analysis. It resembles a situation where the colony has collapsed, but dead bees are still in the hive.

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[1])
#> 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(x = basePop[2:10], n = 9)
#> Error in createMultiColony(x = basePop[2:10], n = 9): object 'basePop' not found
apiary <- cross(apiary, drones = droneGroups[2:10])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Collapse
hasCollapsed(colony)
#> Error in is(x, class2 = "Colony"): object 'colony' not found
colony <- collapse(colony)
#> Error in is(x, class2 = "Colony"): object 'colony' not found
hasCollapsed(colony)
#> Error in is(x, class2 = "Colony"): object 'colony' not found

hasCollapsed(apiary)
#> Error in is(x, class2 = "Colony"): object 'apiary' not found
tmp <- pullColonies(apiary, n = 2)
#> Error in is(x, class2 = "MultiColony"): object 'apiary' not found
tmp
#> Error in eval(expr, envir, enclos): object 'tmp' not found
apiaryLost <- collapse(tmp$pulled)
#> Error in is(x, class2 = "Colony"): object 'tmp' not found
hasCollapsed(apiaryLost)
#> Error in is(x, class2 = "Colony"): object 'apiaryLost' not found
apiaryLeft <- tmp$remnant
#> Error in eval(expr, envir, enclos): object 'tmp' not found
hasCollapsed(apiaryLeft)
#> Error in is(x, class2 = "Colony"): object 'apiaryLeft' not found