Skip to content

Commit ee8a3c0

Browse files
committed
Merge branch 'issue-#369-betterfix' into cran-2.5
2 parents 080ef22 + fae3f42 commit ee8a3c0

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

R/permutest.betadisper.R

+7-6
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,12 @@
9393
if (!hasClus) {
9494
parallel <- makeCluster(parallel)
9595
}
96-
Pstats <- parRapply(parallel, permutations,
97-
function(x) permFun(x))
96+
Pstats <- parApply(parallel, permutations, 1,
97+
function(x) permFun(x))
98+
if (is.null(dim(Pstats)))
99+
Pstats <- matrix(Pstats) # one-column matrix
100+
else
101+
Pstats <- t(Pstats) # transpose statistics to columns
98102
if (!hasClus) {
99103
stopCluster(parallel)
100104
}
@@ -105,10 +109,7 @@
105109

106110
## Process results
107111
F0 <- summary(mod)$fstatistic[1]
108-
if (!is.null(dim(Pstats)))
109-
Fstats <- Pstats[, 1] # allow empty dim to be dropped
110-
else
111-
Fstats <- Pstats
112+
Fstats <- Pstats[, 1, drop=TRUE] # allow empty dim to be dropped
112113
statistic <- F0
113114
names(statistic) <- "Overall (F)"
114115

0 commit comments

Comments
 (0)