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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue May 10 13:24:11 CEST 2011


Author: timotheepoisot
Date: 2011-05-10 13:24:10 +0200 (Tue, 10 May 2011)
New Revision: 45

Added:
   pkg/ESM/R/bip2n3d.r
Modified:
   pkg/ESM/DESCRIPTION
Log:
Added the bip2n3d.r function, to export files to Network3D readable format ?\226?\128?\147 experimental

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

Added: pkg/ESM/R/bip2n3d.r
===================================================================
--- pkg/ESM/R/bip2n3d.r	                        (rev 0)
+++ pkg/ESM/R/bip2n3d.r	2011-05-10 11:24:10 UTC (rev 45)
@@ -0,0 +1,19 @@
+bip2n3d = function(mat,filename='bip2n3d')
+{
+	n3d <- NULL
+	spInf <- NULL
+	for(pred in 1:nrow(mat)) for(prey in 1:ncol(mat))
+	{
+		if(mat[pred,prey]>0)
+		{
+			n3d <- rbind(n3d,c(pred,(nrow(mat)+prey),mat[pred,prey]))
+		}
+	}
+	write.table(n3d,file=paste(filename,'.web',sep=''),row.names=FALSE,col.names=FALSE)
+}
+
+bip2n3d(Sweb[[1]],filename='w1')
+bip2n3d(Sweb[[2]],filename='w2')
+bip2n3d(Sweb[[3]],filename='w3')
+bip2n3d(Sweb[[4]],filename='w4')
+bip2n3d(Sweb[[5]],filename='w5')
\ No newline at end of file



More information about the Esm-commits mailing list