Level 2 function that resets the slots swarm, split, supersedure, collapsed, and production to FALSE in a Colony or MultiColony object. Useful at the end of a yearly cycle to reset the events, allowing the user to track new events in a new year.

resetEvents(x, collapse = NULL)

Arguments

x

Colony-class or MultiColony-class

collapse

logical, reset the collapse event (only sensible in setting up a new colony, which the default of NULL caters for; otherwise, a collapsed colony should be left collapsed forever, unless you force resetting this event with collapse = TRUE)

Value

Colony-class or MultiColony-class with events reset

Examples

founderGenomes <- quickHaplo(nInd = 5, nChr = 1, segSites = 50)
SP <- SimParamBee$new(founderGenomes)
basePop <- createVirginQueens(founderGenomes)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

drones <- createDrones(x = basePop[1], nInd = 100)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
droneGroups <- pullDroneGroupsFromDCA(drones, n = 5, nDrones = nFathersPoisson)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

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

# Build-up - this sets Productive to TRUE
(colony <- buildUp(colony, nWorkers = 100))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
isProductive(colony)
#> Error in is(x, class2 = "Colony"): object 'colony' not found
resetEvents(colony)
#> Error in is(x, class2 = "Colony"): object 'colony' not found

apiary <- buildUp(apiary, nWorkers = 100)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
isProductive(apiary)
#> Error in is(x, class2 = "Colony"): object 'apiary' not found
resetEvents(apiary)
#> Error in is(x, class2 = "Colony"): object 'apiary' not found

# Split - this sets Split to TRUE
tmp <- split(colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
(split <- tmp$split)
#> Error in eval(expr, envir, enclos): object 'tmp' not found
hasSplit(split)
#> Error in hasSplit(split): Argument x must be a Colony or MultiColony class object!
resetEvents(split)
#> Error in resetEvents(split): Argument x must be a Colony or MultiColony class object!
(remnant <- tmp$remnant)
#> Error in eval(expr, envir, enclos): object 'tmp' not found
hasSplit(remnant)
#> Error in is(x, class2 = "Colony"): object 'remnant' not found
resetEvents(remnant)
#> Error in is(x, class2 = "Colony"): object 'remnant' not found

# Swarm - this sets Swarm to TRUE
tmp <- swarm(colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
(swarm <- tmp$swarm)
#> Error in eval(expr, envir, enclos): object 'tmp' not found
hasSwarmed(swarm)
#> Error in hasSwarmed(swarm): Argument x must be a Colony or MultiColony class object!
resetEvents(swarm)
#> Error in resetEvents(swarm): Argument x must be a Colony or MultiColony class object!
(remnant <- tmp$remnant)
#> Error in eval(expr, envir, enclos): object 'tmp' not found
hasSwarmed(remnant)
#> Error in is(x, class2 = "Colony"): object 'remnant' not found
resetEvents(remnant)
#> Error in is(x, class2 = "Colony"): object 'remnant' not found

# Supersede - this sets Supersede to TRUE
(tmp <- supersede(colony))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
hasSuperseded(tmp)
#> Error in is(x, class2 = "Colony"): object 'tmp' not found
resetEvents(tmp)
#> Error in is(x, class2 = "Colony"): object 'tmp' not found

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

# Same behaviour for MultiColony (example for the split)
tmp <- split(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
(splits <- tmp$split)
#> Error in eval(expr, envir, enclos): object 'tmp' not found
hasSplit(splits[[1]])
#> Error in is(x, class2 = "Colony"): object 'splits' not found
resetEvents(splits)[[1]]
#> Error in is(x, class2 = "Colony"): object 'splits' not found
(remnants <- tmp$remnant)
#> Error in eval(expr, envir, enclos): object 'tmp' not found
hasSplit(remnants[[1]])
#> Error in is(x, class2 = "Colony"): object 'remnants' not found
resetEvents(remnants)[[1]]
#> Error in is(x, class2 = "Colony"): object 'remnants' not found