Level 2 function that combines two Colony or MultiColony objects into one or two colonies objects of the same length to one. For example, to combine a weak and a strong colony (or MultiColony). Workers and drones of the weak colony are added to the strong. User has to remove the weak colony (or MultiColony) from the workspace.

combine(strong, weak)

Value

a combined Colony-class or MultiColony-class

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 weak and strong Colony and MultiColony class
colony1 <- createColony(x = basePop[2])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
colony1 <- cross(colony1, drones = droneGroups[[1]])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
colony2 <- createColony(x = basePop[3])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
colony2 <- cross(colony2, drones = droneGroups[[2]])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary1 <- createMultiColony(basePop[4:6], n = 3)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary1 <- cross(apiary1, drones = droneGroups[3:5])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary2 <- createMultiColony(basePop[7:9], n = 3)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary2 <- cross(apiary2, drones = droneGroups[6:8])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Build-up
colony1 <- buildUp(x = colony1, nWorkers = 100, nDrones = 20)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
colony2 <- buildUp(x = colony2, nWorkers = 20, nDrones = 5)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary1 <- buildUp(x = apiary1, nWorkers = 100, nDrones = 20)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary2 <- buildUp(x = apiary2, nWorkers = 20, nDrones = 5)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Combine
nWorkers(colony1); nWorkers(colony2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nDrones(colony1); nDrones(colony2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
colony1 <- combine(strong = colony1, weak = colony2)
#> Error in eval(expr, envir, enclos): object 'colony1' not found
nWorkers(colony1); nWorkers(colony2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nDrones(colony1); nDrones(colony2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
rm(colony2)
#> Warning: object 'colony2' not found

nWorkers(apiary1); nWorkers(apiary2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nDrones(apiary1); nDrones(apiary2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary1 <- combine(strong = apiary1, weak = apiary2)
#> Error in eval(expr, envir, enclos): object 'apiary1' not found
nWorkers(apiary1); nWorkers(apiary2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nDrones(apiary1); nDrones(apiary2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
rm(apiary2)
#> Warning: object 'apiary2' not found