Level 0 function that returns the colony location as (x, y) coordinates.

getLocation(x, collapse = FALSE)

Arguments

x

Colony-class or MultiColony-class

collapse

logical, if the return value should be a single matrix with locations of all the colonies; only applicable when input is a MultiColony-class object

Value

numeric with two values when x is Colony-class

and a list of numeric with two values when x is

MultiColony-class (list named after colonies); c(NA, NA)

when location not set

Examples

founderGenomes <- quickHaplo(nInd = 8, nChr = 1, segSites = 100)
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 = 1000)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
droneGroups <- pullDroneGroupsFromDCA(drones, n = 10, nDrones = nFathersPoisson)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

# Create a Colony and a 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[3:4], n = 2)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
apiary <- cross(apiary, drones = droneGroups[c(2, 3)])
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

getLocation(colony)
#> Error in eval(expr, envir, enclos): object 'colony' not found
getLocation(apiary[[1]])
#> Error in eval(expr, envir, enclos): object 'apiary' not found
getLocation(apiary)
#> Error in eval(expr, envir, enclos): object 'apiary' not found
getLocation(apiary, collapse = TRUE)
#> Error in eval(expr, envir, enclos): object 'apiary' not found

loc <- c(123, 456)
colony <- setLocation(colony, location = loc)
#> Error in eval(expr, envir, enclos): object 'colony' not found
getLocation(colony)
#> Error in eval(expr, envir, enclos): object 'colony' not found

loc1 <- c(512, 722)
colony1 <- setLocation(apiary[[1]], location = loc1)
#> Error in eval(expr, envir, enclos): object 'apiary' not found
getLocation(colony1)
#> Error in eval(expr, envir, enclos): object 'colony1' not found

loc2 <- c(189, 357)
colony2 <- setLocation(apiary[[2]], location = loc2)
#> Error in eval(expr, envir, enclos): object 'apiary' not found
getLocation(colony2)
#> Error in eval(expr, envir, enclos): object 'colony2' not found

getLocation(c(colony1, colony2))
#> Error in eval(expr, envir, enclos): object 'colony1' not found

# Assuming one location (as in bringing colonies to an apiary at a location!)
apiary <- setLocation(apiary, location = loc1)
#> Error in eval(expr, envir, enclos): object 'apiary' not found
getLocation(apiary)
#> Error in eval(expr, envir, enclos): object 'apiary' not found

# Assuming different locations (so tmp is not an apiary in one location!)
tmp <- setLocation(c(colony1, colony2), location = list(loc1, loc2))
#> Error in eval(expr, envir, enclos): object 'colony1' not found
getLocation(tmp)
#> Error in eval(expr, envir, enclos): object 'tmp' not found