Level 2 function that to set a Colony or MultiColony object location to (x, y) coordinates.

setLocation(x, location = c(0, 0))

Arguments

x

Colony-class or MultiColony-class

location

numeric, list, or data.frame, x and y coordinates of colony locations as c(x1, y1) (the same location set to all colonies), list(c(x1, y1), c(x2, y2)), or data.frame(x = c(x1, x2), y = c(y1, y2))

Value

Colony-class or MultiColony-class with set location

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(basePop[1], n = 1000)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found
droneGroups <- pullDroneGroupsFromDCA(drones, n = 4, nDrones = 10)
#> Error in get(x = "SP", envir = .GlobalEnv): object 'SP' not found

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

getLocation(colony)
#> Error in is(x, class2 = "Colony"): object 'colony' not found
getLocation(apiary)
#> Error in is(x, class2 = "Colony"): object 'apiary' not found

loc <- c(1, 1)
colony <- setLocation(colony, location = loc)
#> Error in is(x, class2 = "Colony"): object 'colony' not found
getLocation(colony)
#> Error in is(x, class2 = "Colony"): object 'colony' not found

# Assuming one location (as in bringing colonies to one place!)
apiary <- setLocation(apiary, location = loc)
#> Error in is(x, class2 = "Colony"): object 'apiary' not found
getLocation(apiary)
#> Error in is(x, class2 = "Colony"): object 'apiary' not found

# Assuming different locations
locList <- list(c(0, 0), c(1, 1), c(2, 2))
apiary <- setLocation(apiary, location = locList)
#> Error in is(x, class2 = "Colony"): object 'apiary' not found
getLocation(apiary)
#> Error in is(x, class2 = "Colony"): object 'apiary' not found

locDF <- data.frame(x = c(0, 1, 2), y = c(0, 1, 2))
apiary <- setLocation(apiary, location = locDF)
#> Error in is(x, class2 = "Colony"): object 'apiary' not found
getLocation(apiary)
#> Error in is(x, class2 = "Colony"): object 'apiary' not found