Level 2 function that splits a Colony or MultiColony object into two new colonies to prevent swarming (in managed situation). The remnant colony retains the queen and a proportion of the workers and all drones. The split colony gets the other part of the workers, which raise virgin queens, of which only one prevails. Location of the split is the same as for the remnant.

split(x, p = NULL, year = NULL, simParamBee = NULL, ...)

Arguments

x

Colony-class or MultiColony-class

p

numeric, proportion of workers that will go to the split colony; if NULL then SimParamBee$splitP 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

year

numeric, year of birth for virgin queens

simParamBee

SimParamBee, global simulation parameters

...

additional arguments passed to p when this argument is a function

Value

list with two Colony-class or MultiColony-class, the split and the remnant (see the description what each colony holds!); both outputs have the split even slot set do TRUE

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

# Split a colony
tmp <- split(colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
tmp$split
#> Error in eval(expr, envir, enclos): object 'tmp' not found
tmp$remnant
#> Error in eval(expr, envir, enclos): object 'tmp' not found

# Split all colonies in the apiary with p = 0.5 (50% of workers in each split)
tmp <- split(apiary, p = 0.5)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
tmp$split[[1]]
#> Error in eval(expr, envir, enclos): object 'tmp' not found
tmp$remnant[[1]]
#> Error in eval(expr, envir, enclos): object 'tmp' not found
# Split with different proportions
nWorkers(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
tmp <- split(apiary, p = c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nWorkers(tmp$split)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nWorkers(tmp$remnant)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Split only specific colonies in the apiary
tmp <- pullColonies(apiary, ID = c(4, 5))
#> Error in eval(expr, envir, enclos): object 'apiary' not found
# Split only the pulled colonies
(split(tmp$pulled, p = 0.5))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found