This command used the variables' own formats for their centers. This was
a bad idea for at least two reasons. First, the variables might have a
format that does not show any decimal places, but clusters wouldn't
ordinarily have integer centers, so this is confusing. Second, if a
cluster center happens to have a value label, it could be shown instead,
which is even more confusing. This fixes the problem by using a fixed
format instead.
Thanks to Andreas Hammer for reporting the problem.
for (size_t j = 0; j < qc->n_vars; j++)
{
double x = gsl_matrix_get (matrix, kmeans->group_order->data[i], j);
- union value v = { .f = x };
- pivot_table_put2 (table, i, j,
- pivot_value_new_var_value (qc->vars[j], &v));
+ pivot_table_put2 (table, i, j, pivot_value_new_number (x));
}
pivot_table_submit (table);
Table: Initial Cluster Centers
,Cluster,,
,1,2,3
-x,-11,-12,11
-y,-12,11,11
+x,-10.80,-11.65,11.10
+y,-11.76,10.81,10.91
Table: Final Cluster Centers
,Cluster,,
,1,2,3
-x,-10,-10,10
-y,-10,10,10
+x,-10.22,-10.14,10.28
+y,-10.01,10.22,9.89
Table: Number of Cases in each Cluster
,,Count