12 lines
368 B
R
12 lines
368 B
R
findEmptyPop <- function(npops) {
|
||
# % Palauttaa ensimm<6D>isen tyhj<68>n populaation indeksin. Jos tyhji<6A>
|
||
# % populaatioita ei ole, palauttaa -1:n.
|
||
pops <- t(unique(PARTITION))
|
||
if (length(pops) == npops) {
|
||
emptyPop <- -1
|
||
} else {
|
||
popDiff <- diff(c(0, pops, npops + 1))
|
||
emptyPop <- min(find(popDiff > 1))
|
||
}
|
||
return(list(emptyPop = emptyPop, pops = pops))
|
||
}
|