#define _(msgid) gettext (msgid)
#define N_(msgid) msgid
+enum missing_type
+ {
+ MISS_LISTWISE,
+ MISS_PAIRWISE,
+ };
+
+
struct qc
{
const struct variable **vars;
int maxiter; /* Maximum iterations (Given by the user) */
const struct variable *wv; /* Weighting variable. */
+
+ enum missing_type missing_type;
+ enum mv_class exclude;
};
/* Holds all of the information for the functions. int n, holds the number of
struct ccase *index_case_new = case_create (kmeans->proto);
int bestindex = kmeans_get_nearest_group (kmeans, c, qc);
double weight = qc->wv ? case_data (c, qc->wv)->f : 1.0;
+ assert (bestindex < kmeans->num_elements_groups->size);
kmeans->num_elements_groups->data[bestindex] += weight;
if (kmeans->index_rdr)
{
const struct dictionary *dict = dataset_dict (ds);
qc.ngroups = 2;
qc.maxiter = 2;
+ qc.missing_type = MISS_LISTWISE;
if (!parse_variables_const (lexer, dict, &qc.vars, &qc.n_vars,
PV_NO_DUPLICATE | PV_NUMERIC))
while (casegrouper_get_next_group (grouper, &group))
{
+ if ( qc.missing_type == MISS_LISTWISE )
+ {
+ group = casereader_create_filter_missing (group, qc.vars, qc.n_vars,
+ qc.exclude,
+ NULL, NULL);
+ }
+
kmeans = kmeans_create (&qc);
kmeans_cluster (kmeans, group, &qc);
quick_cluster_show_results (kmeans, &qc);
AT_CLEANUP
+AT_SETUP([QUICK CLUSTER with listwise missing])
+AT_DATA([quick-miss.sps], [dnl
+data list notable list /x *.
+begin data.
+1
+1
+2
+3
+4
+.
+2
+end data.
+
+QUICK CLUSTER x /CRITERIA = CLUSTER(4) MXITER (100).
+])
+
+AT_CHECK([pspp -o pspp-m.csv quick-miss.sps])
+
+AT_DATA([quick-nmiss.sps], [dnl
+data list notable list /x *.
+begin data.
+1
+1
+2
+3
+4
+2
+end data.
+
+QUICK CLUSTER x /CRITERIA = CLUSTER(4) MXITER (100).
+])
+
+AT_CHECK([pspp -o pspp-nm.csv quick-nmiss.sps])
+
+AT_CHECK([diff pspp-m.csv pspp-nm.csv], [0])
+
+
+AT_CLEANUP