ourMELONS/R/poistaTyhjatPopulaatiot.R

15 lines
440 B
R
Raw Normal View History

2020-11-09 08:35:41 +01:00
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))
2020-11-19 08:09:04 +01:00
COUNTS <- COUNTS[, , notEmpty]
SUMCOUNTS <- SUMCOUNTS[notEmpty, ]
LOGDIFF <- LOGDIFF[, notEmpty]
2020-11-09 08:35:41 +01:00
for (n in 1:length(notEmpty)) {
apu <- find(PARTITION == notEmpty(n))
2020-11-19 08:09:04 +01:00
PARTITION[apu] <- n
2020-11-09 08:35:41 +01:00
}
npops <- length(notEmpty)
return(npops)
}