R/Functions_L2_Colony.R
removeCastePop.Rd
Level 2 function that removes a proportion of virgin queens of a Colony or MultiColony object
removeCastePop(
x,
caste = NULL,
p = 1,
use = "rand",
addVirginQueens = FALSE,
nVirginQueens = NULL,
year = NULL,
simParamBee = NULL
)
removeQueen(
x,
addVirginQueens = FALSE,
nVirginQueens = NULL,
year = NULL,
simParamBee = NULL
)
removeWorkers(x, p = 1, use = "rand", simParamBee = NULL)
removeDrones(x, p = 1, use = "rand", simParamBee = NULL)
removeVirginQueens(x, p = 1, use = "rand", simParamBee = NULL)
character, "queen", "workers", "drones", or "virginQueens"
numeric, proportion to be removed; 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
character, all the options provided by selectInd
-
guides selection of virgins queens that will stay when p < 1
logical, whether virgin queens should be added; only used when removing the queen from the colony
integer, the number of virgin queens to be created in the
colony; only used when removing the queen from the colony. If 0
, no virgin
queens are added; If NULL
, the value from simParamBee$nVirginQueens
is used
numeric, only relevant when adding virgin queens - year of birth for virgin queens
SimParamBee
, global simulation parameters
Colony-class
or MultiColony-class
without virgin queens
removeQueen()
: Remove queen from a colony
removeWorkers()
: Remove workers from a colony
removeDrones()
: Remove workers from a colony
removeVirginQueens()
: Remove virgin queens from a colony
founderGenomes <- quickHaplo(nInd = 5, 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 = 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
colony <- buildUp(colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- createMultiColony(basePop[4:5], n = 2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- cross(apiary, drones = droneGroups[3:4])
#> 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
# Remove workers
nWorkers(colony)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
colony <- removeCastePop(colony, caste = "workers", p = 0.3)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# or alias:
colony <- removeWorkers(colony, p = 0.3)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Same aliases exist for all the castes!!
nWorkers(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- removeCastePop(apiary, caste = "workers", p = 0.3)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nWorkers(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
# Remove different proportions
apiary <- buildUp(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nWorkers(apiary)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
nWorkers(removeWorkers(apiary, p = c(0.1, 0.5)))
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found