Set miscelaneous information in a population
setMisc(x, node = NULL, value = NULL)
Pop-class
with x@misc[[*]][[node]]
set
basePop <- newPop(founderGenomes)
basePop <- setMisc(basePop, node = "info", value = 1) basePop@misc getMisc(x = basePop, node = "info")
basePop <- setMisc(basePop, node = "info2", value = c("A", "B", "C")) basePop@misc getMisc(x = basePop, node = "info2")
n <- nInd(basePop) location <- vector(mode = "list", length = n) for (ind in seq_len(n)) location[[ind]] <- runif(n = 2, min = 0, max = 100)
location basePop <- setMisc(basePop, node = "location", value = location) basePop@misc getMisc(x = basePop, node = "location")
n <- nInd(basePop) location <- vector(mode = "list", length = n) for (ind in c(1, 3)) location[[ind]] <- runif(n = 2, min = 0, max = 100)
location basePop <- setMisc(basePop, node = "location", value = location) basePop@misc getMisc(x = basePop, node = "location")
getMisc(x = basePop)
Pop-class
character, name of the node to set within the x@misc
slot
value to be saved into x@misc[[*]][[node]]
; length of
value
should be equal to nInd(x)
; if its length is 1, then
it is repeated using rep
(see examples)
A NULL
in value
is ignored