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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jul 9 04:03:26 CEST 2008


Author: mrhelmus
Date: 2008-07-09 04:03:25 +0200 (Wed, 09 Jul 2008)
New Revision: 129

Modified:
   branches/gsoc/R/phylodiversity.R
Log:
Fixed Bug: mean was not computing with NAs output by modified psv

Modified: branches/gsoc/R/phylodiversity.R
===================================================================
--- branches/gsoc/R/phylodiversity.R	2008-07-01 08:47:02 UTC (rev 128)
+++ branches/gsoc/R/phylodiversity.R	2008-07-09 02:03:25 UTC (rev 129)
@@ -400,7 +400,7 @@
   Cmatrix<-Cmatrix[indexcov,indexcov]
   samp<-samp[,indexcov]
 
-  obs.PSV<-mean(psv(samp,Cmatrix,compute.var=FALSE)[,1])
+  obs.PSV<-mean(psv(samp,Cmatrix,compute.var=FALSE)[,1],na.rm=TRUE)
 
   # numbers of locations and species
   nlocations<-dim(samp)[1]
@@ -411,7 +411,7 @@
   {
     spp.samp<-samp[,-j]
     spp.Cmatrix<-Cmatrix[-j,-j]
-    spp.PSV<-mean(psv(spp.samp,spp.Cmatrix,compute.var=FALSE)[,1])
+    spp.PSV<-mean(psv(spp.samp,spp.Cmatrix,compute.var=FALSE)[,1],na.rm=TRUE)
     spp.PSVs<-c(spp.PSVs,spp.PSV)
   }
   spp.PSVout<-(spp.PSVs-obs.PSV)/sum(abs(spp.PSVs-obs.PSV))



More information about the Picante-commits mailing list