[Vegan-commits] r1190 - in pkg/vegan: R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri May 21 13:58:12 CEST 2010


Author: jarioksa
Date: 2010-05-21 13:58:11 +0200 (Fri, 21 May 2010)
New Revision: 1190

Modified:
   pkg/vegan/R/RsquareAdj.R
   pkg/vegan/inst/ChangeLog
Log:
RsquareAdj handles vector arguments

Modified: pkg/vegan/R/RsquareAdj.R
===================================================================
--- pkg/vegan/R/RsquareAdj.R	2010-05-21 08:08:32 UTC (rev 1189)
+++ pkg/vegan/R/RsquareAdj.R	2010-05-21 11:58:11 UTC (rev 1190)
@@ -8,10 +8,10 @@
 `RsquareAdj.default` <-
     function(x, n, m, ...)
 {
-    if (m >= (n-1))
-        NA
-    else
-        1 - (1-x)*(n-1)/(n-m-1)
+    r2 <- 1 - (1-x)*(n-1)/(n-m-1)
+    if (any(na <- m >= n-1))
+        r2[na] <- NA
+    r2
 }
 
 ## Use this with rda() results

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-05-21 08:08:32 UTC (rev 1189)
+++ pkg/vegan/inst/ChangeLog	2010-05-21 11:58:11 UTC (rev 1190)
@@ -4,6 +4,8 @@
 
 Version 1.18-5 (opened May 21, 2010) 
 
+	* RsquareAdj.default: handles vector arguments.
+
 	* ordiellipse: works only with 2D data, and now uses only first
 	two dimensions of input if more given. For instance, the following
 	works now, but gave very cryptic error message previously:
@@ -17,8 +19,8 @@
 	resampled in simulate.cca() where they are again weighted after
 	being added to the new fitted value.
 
-	* mantel.correlog: changes the Sturge's rule to conform with the
-	standard R nclass.Sturges ('ceiling' instead of 'round'. Extends
+	* mantel.correlog: changes the Sturges rule to conform with the
+	standard R nclass.Sturges ('ceiling' instead of 'round'). Extends
 	and corrects documentation and messages.
 
 Version 1.18-4 (closed May 21, 2010)



More information about the Vegan-commits mailing list