[Analogue-commits] r292 - pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jan 3 13:04:30 CET 2013


Author: gsimpson
Date: 2013-01-03 13:04:29 +0100 (Thu, 03 Jan 2013)
New Revision: 292

Modified:
   pkg/src/distx.c
Log:
set ordinal data handling to be same as nominal for time being

Modified: pkg/src/distx.c
===================================================================
--- pkg/src/distx.c	2013-01-03 11:53:27 UTC (rev 291)
+++ pkg/src/distx.c	2013-01-03 12:04:29 UTC (rev 292)
@@ -4,7 +4,7 @@
  * Based on code from vegdist by Jari Oksanen:
  *
  * (C) 2001-2009, Jari Oksanen
- * (C) 2009 Gavin L. Simpson
+ * (C) 2009-2012 Gavin L. Simpson
  *
  * Licene: GPL 2
  */
@@ -519,14 +519,15 @@
 			    wsum -= weights[j];
 		    }
 	    }
-	    if(vtype[j] == 3) {
+	    if(vtype[j] == 3) { // Nominal
 		dev = (x[i1] == x[i2]) ? 1 : 0;
 		dist += dev * weights[j];
 	    }
-	    if(vtype[j] == 4) {
-		/* ordinal data current not handled 
-		 * so don't call this yet
-		 */
+	    if(vtype[j] == 4) { // Ordinal
+		/* ordinal data currently handled as Nominal */
+		dev = (x[i1] == x[i2]) ? 1 : 0;
+		dist += dev * weights[j];
+		break;
 	    }
 	    if(vtype[j] == 5) {
 		dev = 1 - (fabs(x[i1] - x[i2]) / R[j]);



More information about the Analogue-commits mailing list