QUICK CLUSTER: Add MISSING=EXCLUDE for consistency with other commands
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 9 Jul 2011 07:53:53 +0000 (09:53 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 9 Jul 2011 07:53:53 +0000 (09:53 +0200)
src/language/stats/quick-cluster.c

index 10572cee5e260a8a1590c56742489586741f1053..e6987f4b10b5db503a799b66665a796665407a17 100644 (file)
@@ -227,11 +227,12 @@ kmeans_recalculate_centers (struct Kmeans *kmeans, const struct casereader *read
        {
          const union value *val = case_data (c, qc->vars[v]);
          double x = val->f * weight;
+         double curval;
 
          if ( var_is_value_missing (qc->vars[v], val, qc->exclude))
            continue;
 
-         double curval = gsl_matrix_get (kmeans->centers, index, v);
+         curval = gsl_matrix_get (kmeans->centers, index, v);
          gsl_matrix_set (kmeans->centers, index, v, curval + x);
        }
       i++;
@@ -528,6 +529,10 @@ cmd_quick_cluster (struct lexer *lexer, struct dataset *ds)
                {
                  qc.exclude = MV_SYSTEM;
                }
+             else if (lex_match_id (lexer, "EXCLUDE"))
+               {
+                 qc.exclude = MV_ANY;
+               }
              else
                goto error;
            }