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)
SP$nThreads = 1L
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 get(x = "SP", envir = .GlobalEnv): object 'SP' 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 eval(expr, envir, enclos): object 'colony' not found
colony <- collapse(colony)
#> Error in eval(expr, envir, enclos): object 'colony' not found
hasCollapsed(colony)
#> Error in eval(expr, envir, enclos): object 'colony' not found

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