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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Aug 28 13:02:06 CEST 2010


Author: timotheepoisot
Date: 2010-08-28 13:02:05 +0200 (Sat, 28 Aug 2010)
New Revision: 30

Modified:
   pkg/ESM/DESCRIPTION
   pkg/ESM/R/.Rhistory
   pkg/ESM/R/functions.r
Log:
revHS

Modified: pkg/ESM/DESCRIPTION
===================================================================
--- pkg/ESM/DESCRIPTION	2010-03-05 19:21:57 UTC (rev 29)
+++ pkg/ESM/DESCRIPTION	2010-08-28 11:02:05 UTC (rev 30)
@@ -1,6 +1,6 @@
 Package: ESM
-Version: 1.0.0-02
-Date: 2010-02-04
+Version: 1.1.0-05
+Date: 2010-04-27
 Title: Ecological Specificity Measures
 Author: Timothee Poisot <tpoisot at um2.fr>
 Maintainer: Timothee Poisot <tpoisot at um2.fr>
@@ -8,4 +8,4 @@
 Suggests: vegan, bipartite, ade4
 Description: Performs several measures of ecological specificity 
 License: GPL (>= 2) 
-URL: http://www.timotheepoisot.fr/R/
\ No newline at end of file
+URL: http://www.timotheepoisot.fr/
\ No newline at end of file

Modified: pkg/ESM/R/.Rhistory
===================================================================
--- pkg/ESM/R/.Rhistory	2010-03-05 19:21:57 UTC (rev 29)
+++ pkg/ESM/R/.Rhistory	2010-08-28 11:02:05 UTC (rev 30)
@@ -196,7 +196,6 @@
 }
 sortmat.byspe(library(ESM)
 )
-library(ESM)
 sortmat.byspe
 ?sortmat.byspe
 ?getspe
@@ -494,3 +493,10 @@
 draw.network(dune,sortorg=rank(getspe(dune,hr)),org.col='green')
 draw.network(dune,sortorg=rank(getspe(dune,hr)),org.col='palegreen')
 draw.network(dune,sortorg=rank(getspe(dune,hr)),org.col='palegreen',res.col='pink')
+get.HS(1)
+get.HS(0)
+get.Hrr(0)
+get.rr(0)
+get.RR(0)
+library(ESM)
+get.RR(1)

Modified: pkg/ESM/R/functions.r
===================================================================
--- pkg/ESM/R/functions.r	2010-03-05 19:21:57 UTC (rev 29)
+++ pkg/ESM/R/functions.r	2010-08-28 11:02:05 UTC (rev 30)
@@ -1,5 +1,6 @@
 get.PDI <- function(fit)
 {
+	if(length(fit)==1){return(1)}
 	fit <- sort(as.vector(fit),decreasing=TRUE)
 	test <- fit[2:length(fit)]
 	out <- sum(fit[1]-test)/length(test)
@@ -8,6 +9,7 @@
 
 get.RR <- function(pop)
 {
+	if(length(pop)==1){return(1)}
 	Ni <- sum(pop>0)
 	N <- length(pop)
 	return(1-(Ni-1)/(N-1))
@@ -15,6 +17,7 @@
 
 get.HS <- function(pop)
 {
+	if(length(pop)==1){return(1)}
 	partiel <- NULL
 	pop <- as.vector(pop)+0.000000000001
 	for(i in 1:length(pop))
@@ -28,6 +31,7 @@
 
 get.SSI <- function(occup)
 {
+	if(length(occup)==1){return(1)}
 	score <- NULL
 	fit <- as.vector(occup)
 	h <- sum(fit>0)
@@ -86,6 +90,7 @@
 
 cv		= function(d) sd(d)/mean(d)
 last	= function(d) d[length(d)]
+
 scale = function(v,m=0,M=1)
 {
 	v <- v-min(v)
@@ -94,6 +99,7 @@
 	v <- v+m
 	return(v)
 }
+
 dmat = function(m,n=2)
 {
 	e <- (max(m)-min(m))/n



More information about the Esm-commits mailing list