[Analogue-commits] r198 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jan 13 16:51:12 CET 2011


Author: gsimpson
Date: 2011-01-13 16:51:11 +0100 (Thu, 13 Jan 2011)
New Revision: 198

Modified:
   pkg/R/distance.R
Log:
some NA reslience added to a couple of coefficients

Modified: pkg/R/distance.R
===================================================================
--- pkg/R/distance.R	2010-09-29 19:09:33 UTC (rev 197)
+++ pkg/R/distance.R	2011-01-13 15:51:11 UTC (rev 198)
@@ -210,11 +210,11 @@
     }
     if(method %in% c("gower", "alt.gower", "mixed")) {
         maxi <- mini <- numeric(length = n.vars)
-        maxi <- apply(rbind(apply(x, 2, max),
-                            apply(y, 2, max)),
+        maxi <- apply(rbind(apply(x, 2, max, na.rm = TRUE),
+                            apply(y, 2, max, na.rm = TRUE)),
                       2, max, na.rm = TRUE)
-        mini <- apply(rbind(apply(x, 2, min),
-                            apply(y, 2, min)),
+        mini <- apply(rbind(apply(x, 2, min, na.rm = TRUE),
+                            apply(y, 2, min, na.rm = TRUE)),
                       2, min, na.rm = TRUE)
         if(is.null(R))
             R <- maxi - mini



More information about the Analogue-commits mailing list