[Picante-commits] r150 - branches/gsoc/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jul 23 06:52:47 CEST 2008


Author: skembel
Date: 2008-07-23 06:52:47 +0200 (Wed, 23 Jul 2008)
New Revision: 150

Modified:
   branches/gsoc/R/randomizeSample.R
Log:
fix randomizeSample to return a properly named matrix

Modified: branches/gsoc/R/randomizeSample.R
===================================================================
--- branches/gsoc/R/randomizeSample.R	2008-07-23 04:23:19 UTC (rev 149)
+++ branches/gsoc/R/randomizeSample.R	2008-07-23 04:52:47 UTC (rev 150)
@@ -3,7 +3,7 @@
 } 
 
 `randomizeSample` <-
-function(samp, null.model=c("frequency","richness","both"),it=100) {
+function(samp, null.model=c("frequency","richness","both"),it=10000) {
 	samp<-as.matrix(samp)
   
   null.model <- match.arg(null.model)
@@ -15,10 +15,10 @@
 	}
 	if (identical(null.model,"both")) 
     {
-    ret1 <- .C("trialswap", m=as.numeric(samp), as.integer(it), as.integer(nrow(samp)), as.integer(ncol(samp)), PACKAGE="picante")
-    return(matrix(ret1$m,nrow=nrow(samp)))
+        ret1 <- .C("trialswap", m=as.numeric(samp), as.integer(it), as.integer(nrow(samp)), as.integer(ncol(samp)), PACKAGE="picante")
+        return(matrix(ret1$m,nrow=nrow(samp),dimnames=list(rownames(samp),colnames(samp))))
 	}
-	
+
 #  #check for presence-absence and warn until abundance implemented
 #        x <- decostand(samp, "pa")
 #        if (!identical(x,samp)) stop("Null model currently requires a presence-absence matrix.")



More information about the Picante-commits mailing list