Level 2 function that replaces a proportion of caste individuals with new individuals from a Colony or MultiColony object. Useful after events like season change, swarming, supersedure, etc. due to the short life span honeybees.

replaceCastePop(
  x,
  caste = NULL,
  p = 1,
  use = "rand",
  exact = TRUE,
  year = NULL,
  simParamBee = NULL
)

replaceWorkers(x, p = 1, use = "rand", exact = TRUE, simParamBee = NULL)

replaceDrones(x, p = 1, use = "rand", simParamBee = NULL)

replaceVirginQueens(x, p = 1, use = "rand", simParamBee = NULL)

Arguments

x

Colony-class or MultiColony-class

caste

character, "workers", "drones", or "virginQueens"

p

numeric, proportion of caste individuals to be replaced with new ones; 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 - guides selection of caste individuals that stay when p < 1

exact

logical, only relevant when adding workers - if the csd locus is turned on and exact is TRUE, we replace the exact specified number of viable workers (heterozygous at the csd locus). You probably want this set to TRUE since you want to replace with the same number of workers.

year

numeric, only relevant when replacing virgin queens, year of birth for virgin queens

simParamBee

SimParamBee, global simulation parameters

Value

Colony-class or or MultiColony-class with replaced virgin queens

Functions

  • replaceWorkers(): Replaces some workers in a colony

  • replaceDrones(): Replaces some drones in a colony

  • replaceVirginQueens(): Replaces some virgin queens in a colony

Examples

founderGenomes <- quickHaplo(nInd = 5, nChr = 1, segSites = 50)
SP <- SimParamBee$new(founderGenomes)
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 createMultiColony(basePop[4:5], n = 2): object 'basePop' not found
apiary <- cross(apiary, drones = droneGroups[3:4])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Add individuals
colony <- buildUp(colony, nWorkers = 5, nDrones = 2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- buildUp(apiary, nWorkers = 5, nDrones = 2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Replace workers in a colony
getCasteId(colony, caste = "workers")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
colony <- replaceCastePop(colony, caste = "workers", p = 0.5)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# You can also use an alias
replaceWorkers(colony, p = 0.5)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Same aliases exist for all the castes!!!
getCasteId(colony, caste = "workers")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

getCasteId(apiary, caste="workers")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- replaceWorkers(apiary, p = 0.5)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
getCasteId(apiary, caste="workers")
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found