[Esm-commits] r44 - in pkg/ESM: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Apr 16 19:08:24 CEST 2011


Author: timotheepoisot
Date: 2011-04-16 19:08:23 +0200 (Sat, 16 Apr 2011)
New Revision: 44

Modified:
   pkg/ESM/DESCRIPTION
   pkg/ESM/R/functions.r
Log:
updates ssi

Modified: pkg/ESM/DESCRIPTION
===================================================================
--- pkg/ESM/DESCRIPTION	2011-01-17 21:41:45 UTC (rev 43)
+++ pkg/ESM/DESCRIPTION	2011-04-16 17:08:23 UTC (rev 44)
@@ -1,5 +1,5 @@
 Package: ESM
-Version: 2.0.2-01
+Version: 2.0.2-02
 Date: 2011-01-17
 Title: Ecological Specificity Measures
 Author: Timothee Poisot <tpoisot at um2.fr>

Modified: pkg/ESM/R/functions.r
===================================================================
--- pkg/ESM/R/functions.r	2011-01-17 21:41:45 UTC (rev 43)
+++ pkg/ESM/R/functions.r	2011-04-16 17:08:23 UTC (rev 44)
@@ -93,14 +93,14 @@
 	return(v)
 }
 
-dmat = function(m,n=2)
+dmat = function(mat,n=2)
 {
-	e <- (max(m)-min(m))/n
-	cl <- seq(from=0,to=1,by=e)
-	nm <- matrix(0,ncol=ncol(m),nrow=nrow(m))
-	for(i in 1:(length(cl)-1))
+	new <- mat
+	Levs <- seq(min(mat),max(mat),length=n)
+	for(i in 1:length(Levs))
 	{
-		nm[(cl[i]<m)&(m<=cl[(i+1)])] <- cl[i]
+		AreOk <- (new>Levs[i])&(new<=Levs[(i+1)])
+		new[AreOk] <- Levs[(i+1)]
 	}
-	return(scale(nm,0,1))
+	return(new)
 }
\ No newline at end of file



More information about the Esm-commits mailing list