Level 3 function that creates a set of colonies. Usually to start a simulation.

createMultiColony(x = NULL, n = NULL)

Arguments

x

Pop-class, virgin queens or queens for the colonies (selected at random if there are more than n in Pop, while all are used when n is NULL)

n

integer, number of colonies to create (if only n is given then MultiColony-class is created with n NULL) individual colony - this is mostly useful for programming)

Details

When both x and n are NULL, then a MultiColony-class with 0 colonies is created.

Examples

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

# Create 2 empty (NULL) colonies
apiary <- createMultiColony(n = 2)
apiary
#> An object of class "MultiColony" 
#> Number of colonies: 2 
#> Are empty: 2 
#> Are NULL: 2 
#> Have split: 0 
#> Have swarmed: 0 
#> Have superseded: 0 
#> Have collapsed: 0 
#> Are productive: 0 
apiary[[1]]
#> NULL
apiary[[2]]
#> NULL

# Create 3 virgin colonies
apiary <- createMultiColony(x = basePop, n = 3) # specify n
#> Error in createMultiColony(x = basePop, n = 3): object 'basePop' not found
apiary <- createMultiColony(x = basePop[1:3]) # take all provided
#> Error in createMultiColony(x = basePop[1:3]): object 'basePop' not found
apiary
#> An object of class "MultiColony" 
#> Number of colonies: 2 
#> Are empty: 2 
#> Are NULL: 2 
#> Have split: 0 
#> Have swarmed: 0 
#> Have superseded: 0 
#> Have collapsed: 0 
#> Are productive: 0 
apiary[[1]]
#> NULL
apiary[[2]]
#> NULL

# Create mated colonies by crossing
apiary <- createMultiColony(x = basePop[1:2], n = 2)
#> Error in createMultiColony(x = basePop[1:2], n = 2): object 'basePop' not found
drones <- createDrones(x = basePop[3], n = 30)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
droneGroups <- pullDroneGroupsFromDCA(drones, n = 2, nDrones = 15)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- cross(apiary, drones = droneGroups)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary
#> An object of class "MultiColony" 
#> Number of colonies: 2 
#> Are empty: 2 
#> Are NULL: 2 
#> Have split: 0 
#> Have swarmed: 0 
#> Have superseded: 0 
#> Have collapsed: 0 
#> Are productive: 0 
apiary[[1]]
#> NULL
apiary[[2]]
#> NULL