[Vegan-commits] r1642 - in pkg/permute: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jun 19 11:45:37 CEST 2011


Author: gsimpson
Date: 2011-06-19 11:45:36 +0200 (Sun, 19 Jun 2011)
New Revision: 1642

Modified:
   pkg/permute/R/allPerms.R
   pkg/permute/man/allPerms.Rd
   pkg/permute/man/shuffle.Rd
Log:
bug in allPerms use of control, stop man pages using nobs as an object

Modified: pkg/permute/R/allPerms.R
===================================================================
--- pkg/permute/R/allPerms.R	2011-06-18 13:51:36 UTC (rev 1641)
+++ pkg/permute/R/allPerms.R	2011-06-19 09:45:36 UTC (rev 1642)
@@ -9,7 +9,7 @@
             res[[i]] <- mat
         do.call(rbind, res)
     }
-    BAE <- function(mat, n) {
+    BAR <- function(mat, n) {
         res <- list()
         res[[1]] <- mat
         res <- rep(res, n)
@@ -33,8 +33,7 @@
         stop("Number of possible permutations too large (> 'max')")
     type.wi <- ctrl$within$type
     if(type.wi != "none") {
-        if(is.null(control$strata)) {
-            ##browser()
+        if(is.null(ctrl$strata)) {
             res <- switch(type.wi,
                           free = allFree(n),
                           series = allSeries(n, nperms, ctrl$within$mirror),
@@ -76,7 +75,7 @@
                     sp <- split(v, ctrl$strata)
                     res <- vector(mode = "list", length = ng)
                     add <- c(0, cumsum(tab)[1:(ng-1)])
-                    for(j in seq(along = tab)) {
+                    for(j in seq_along(tab)) {
                         nperms <- numPerms(tab[j], ctrl.wi)
                         ord <- switch(type.wi,
                                       free = allFree(tab[j]),

Modified: pkg/permute/man/allPerms.Rd
===================================================================
--- pkg/permute/man/allPerms.Rd	2011-06-18 13:51:36 UTC (rev 1641)
+++ pkg/permute/man/allPerms.Rd	2011-06-19 09:45:36 UTC (rev 1642)
@@ -70,16 +70,16 @@
 ctrl <- permControl(strata = fac,
                     within = Within(type = "grid", mirror = FALSE,
                                     constant = TRUE, nrow = 3, ncol = 2))
-nobs <- length(fac)
-numPerms(seq_len(nobs), control = ctrl)
-(tmp <- allPerms(nobs, control = ctrl, observed = TRUE))
-(tmp2 <- allPerms(nobs, control = ctrl))
+Nobs <- length(fac)
+numPerms(seq_len(Nobs), control = ctrl)
+(tmp <- allPerms(Nobs, control = ctrl, observed = TRUE))
+(tmp2 <- allPerms(Nobs, control = ctrl))
 
 ## turn on mirroring
 ctrl$within$mirror <- TRUE
-numPerms(seq_len(nobs), control = ctrl)
-(tmp3 <- allPerms(nobs, control = ctrl, observed = TRUE))
-(tmp4 <- allPerms(nobs, control = ctrl))
+numPerms(seq_len(Nobs), control = ctrl)
+(tmp3 <- allPerms(Nobs, control = ctrl, observed = TRUE))
+(tmp4 <- allPerms(Nobs, control = ctrl))
 
 %\dontrun{
 ## prints out details of the permutation scheme as

Modified: pkg/permute/man/shuffle.Rd
===================================================================
--- pkg/permute/man/shuffle.Rd	2011-06-18 13:51:36 UTC (rev 1641)
+++ pkg/permute/man/shuffle.Rd	2011-06-19 09:45:36 UTC (rev 1642)
@@ -218,7 +218,7 @@
     ## check the control object
     control <- permCheck(x, control)$control
     ## number of observations
-    nobs <- getNumObs(x)
+    Nobs <- getNumObs(x)
     ## group names
     lev <- names(table(group))
     ## vector to hold results, +1 because of observed t
@@ -228,7 +228,7 @@
     ## generate randomisation distribution of t
     for(i in seq_along(t.permu)) {
         ## return a permutation
-        want <- permute(i, nobs, control)
+        want <- permute(i, Nobs, control)
         ## calculate permuted t
         t.permu[i+1] <- t.statistic(x[want][group == lev[1]],
                                     x[want][group == lev[2]])



More information about the Vegan-commits mailing list