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)
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
)
Colony-class
or MultiColony-class
with
events reset
founderGenomes <- quickHaplo(nInd = 5, 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(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 get(x = "SP", envir = .GlobalEnv): object 'SP' 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 eval(expr, envir, enclos): object 'colony' not found
resetEvents(colony)
#> Error in eval(expr, envir, enclos): object 'colony' not found
apiary <- buildUp(apiary, nWorkers = 100)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
isProductive(apiary)
#> Error in eval(expr, envir, enclos): object 'apiary' not found
resetEvents(apiary)
#> Error in eval(expr, envir, enclos): 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 eval(expr, envir, enclos): object 'remnant' not found
resetEvents(remnant)
#> Error in eval(expr, envir, enclos): 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 eval(expr, envir, enclos): object 'remnant' not found
resetEvents(remnant)
#> Error in eval(expr, envir, enclos): 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 eval(expr, envir, enclos): object 'tmp' not found
resetEvents(tmp)
#> Error in eval(expr, envir, enclos): object 'tmp' not found
# Collapse - this sets Collapse to TRUE
(tmp <- collapse(colony))
#> Error in eval(expr, envir, enclos): object 'colony' not found
hasCollapsed(tmp)
#> Error in eval(expr, envir, enclos): object 'tmp' not found
resetEvents(tmp)
#> Error in eval(expr, envir, enclos): object 'tmp' not found
resetEvents(tmp, collapse = TRUE)
#> Error in eval(expr, envir, enclos): 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 eval(expr, envir, enclos): object 'splits' not found
resetEvents(splits)[[1]]
#> Error in eval(expr, envir, enclos): object 'splits' not found
(remnants <- tmp$remnant)
#> Error in eval(expr, envir, enclos): object 'tmp' not found
hasSplit(remnants[[1]])
#> Error in eval(expr, envir, enclos): object 'remnants' not found
resetEvents(remnants)[[1]]
#> Error in eval(expr, envir, enclos): object 'remnants' not found