Improved exception handling

This commit is contained in:
Waldir Leoncio 2020-07-14 11:17:25 +02:00
parent e89c51de57
commit bb44d0cfd4
3 changed files with 6 additions and 4 deletions

View file

@ -24,6 +24,6 @@ computeAllFreqs2 <- function (noalle, COUNTS = matrix(NA, 0, 0),
}
prioriAlleelit <- repmat(prioriAlleelit, c(1, 1, npops))
counts <- COUNTS + prioriAlleelit
allFreqs <- counts / sumCounts
allFreqs <- counts / drop(sumCounts)
return(allFreqs)
}

View file

@ -13,8 +13,8 @@
repmat <- function (mx, n) {
# Validation
if (length(n) > 3) warning("Extra dimensions of n ignored")
if (!is(mx, "matrix")) mx <- t(as.matrix(mx))
if (length(n) == 1) n <- rep(n, 2)
if (!is(mx, "matrix")) mx <- as.matrix(mx)
# Replicating cols
out <- mx_col <- matrix(rep(mx, n[2]), nrow(mx))