Improved function behavior on empty matrices
This commit is contained in:
parent
8323d54c01
commit
37822b2ec8
1 changed files with 5 additions and 3 deletions
|
|
@ -6,7 +6,7 @@
|
|||
#' @param SUMCOUNTS sumcounts
|
||||
#' @export
|
||||
computeAllFreqs2 <- function (noalle, COUNTS = matrix(NA, 0, 0),
|
||||
SUMCOUNTS = sum(COUNTS)) {
|
||||
SUMCOUNTS = NA) {
|
||||
|
||||
max_noalle <- size(COUNTS, 1)
|
||||
nloci <- size(COUNTS,2)
|
||||
|
|
@ -17,8 +17,10 @@ computeAllFreqs2 <- function (noalle, COUNTS = matrix(NA, 0, 0),
|
|||
sumCounts <- repmat(sumCounts, c(max_noalle, 1, 1))
|
||||
|
||||
prioriAlleelit <- zeros(max_noalle, nloci)
|
||||
for (j in 1:nloci) {
|
||||
prioriAlleelit[1:noalle[j], j] <- 1 / noalle[j]
|
||||
if (nloci > 0) {
|
||||
for (j in 1:nloci) {
|
||||
prioriAlleelit[1:noalle[j], j] <- 1 / noalle[j]
|
||||
}
|
||||
}
|
||||
prioriAlleelit <- repmat(prioriAlleelit, c(1, 1, npops))
|
||||
counts <- COUNTS + prioriAlleelit
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue