ourMELONS/R/poistaTyhjatPopulaatiot.R
2022-02-03 10:43:34 +01:00

15 lines
475 B
R
Raw Blame History

poistaTyhjatPopulaatiot <- function(npops) {
# % Poistaa tyhjentyneet populaatiot COUNTS:ista ja
# % SUMCOUNTS:ista. P<>ivitt<74><74> npops:in ja PARTITION:in.
notEmpty <- matlab2r::find(any(SUMCOUNTS, 2))
COUNTS <- COUNTS[, , notEmpty]
SUMCOUNTS <- SUMCOUNTS[notEmpty, ]
LOGDIFF <- LOGDIFF[, notEmpty]
for (n in 1:length(notEmpty)) {
apu <- matlab2r::find(PARTITION == notEmpty(n))
PARTITION[apu] <- n
}
npops <- length(notEmpty)
return(npops)
}