ourMELONS/R/poistaTyhjatPopulaatiot.R
2020-11-19 08:09:04 +01:00

15 lines
No EOL
440 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 <- find(any(SUMCOUNTS, 2))
COUNTS <- COUNTS[, , notEmpty]
SUMCOUNTS <- SUMCOUNTS[notEmpty, ]
LOGDIFF <- LOGDIFF[, notEmpty]
for (n in 1:length(notEmpty)) {
apu <- find(PARTITION == notEmpty(n))
PARTITION[apu] <- n
}
npops <- length(notEmpty)
return(npops)
}