Level 2 function that downsizes a Colony or MultiColony object by removing a proportion of workers, all drones and all virgin queens. Usually in the autumn, such an event occurs in preparation for the winter months.

downsize(x, p = NULL, use = "rand", new = FALSE, simParamBee = NULL, ...)

Arguments

x

Colony-class or MultiColony-class

p

numeric, proportion of workers to be removed from the colony; if NULL then SimParamBee$downsizeP is used. If input is MultiColony-class, the input could also be a vector of the same length as the number of colonies. If a single value is provided, the same value will be applied to all the colonies

use

character, all the options provided by selectInd; it guides the selection of workers that will be removed

new

logical, should we remove all current workers and add a targeted proportion anew (say, create winter workers)

simParamBee

SimParamBee, global simulation parameters

...

additional arguments passed to p when this argument is a function

Value

Colony-class or MultiColony-class with workers reduced and drones/virgin queens removed

Examples

founderGenomes <- quickHaplo(nInd = 4, 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 = 3, nDrones = 12)
#> 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
colony <- buildUp(colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- createMultiColony(basePop[3:4], n = 2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- cross(apiary, drones = droneGroups[c(2, 3)])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- buildUp(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Downsize
colony <- downsize(x = colony, new = TRUE, use = "rand")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
colony
#> Error in eval(expr, envir, enclos): object 'colony' not found
apiary <- downsize(x = apiary, new = TRUE, use = "rand")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary[[1]]
#> Error in eval(expr, envir, enclos): object 'apiary' not found

# Downsize with different numbers
nWorkers(apiary); nDrones(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- downsize(x = apiary, p = c(0.5, 0.1), new = TRUE, use = "rand")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nWorkers(apiary); nDrones(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found