From: John Darrington Date: Sun, 23 Jun 2019 16:49:47 +0000 (+0200) Subject: MEANS: Fix output with unusual formats X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76ce1b51c803d48ff034d6f036768ce1af809945;p=pspp MEANS: Fix output with unusual formats --- diff --git a/src/language/stats/means-calc.c b/src/language/stats/means-calc.c index 5a3c205b97..54b4e9cce5 100644 --- a/src/language/stats/means-calc.c +++ b/src/language/stats/means-calc.c @@ -435,11 +435,11 @@ const struct cell_spec cell_spec[n_MEANS_STATISTICS] = { {N_("Minimum"), "MIN", NULL , min_create, min_update, min_get, simple_destroy}, {N_("Maximum"), "MAX", NULL , max_create, max_update, max_get, simple_destroy}, {N_("Range"), "RANGE", NULL , range_create, range_update, range_get, simple_destroy}, - {N_("Variance"), "VARIANCE", NULL , default_create, default_update, variance_get, default_destroy}, - {N_("Kurtosis"), "KURT", NULL , default_create, default_update, kurt_get, default_destroy}, - {N_("S.E. Kurt"), "SEKURT", NULL , default_create, default_update, sekurt_get, default_destroy}, - {N_("Skewness"), "SKEW", NULL , default_create, default_update, skew_get, default_destroy}, - {N_("S.E. Skew"), "SESKEW", NULL , default_create, default_update, seskew_get, default_destroy}, + {N_("Variance"), "VARIANCE", PIVOT_RC_OTHER, default_create, default_update, variance_get, default_destroy}, + {N_("Kurtosis"), "KURT", PIVOT_RC_OTHER, default_create, default_update, kurt_get, default_destroy}, + {N_("S.E. Kurt"), "SEKURT", PIVOT_RC_OTHER, default_create, default_update, sekurt_get, default_destroy}, + {N_("Skewness"), "SKEW", PIVOT_RC_OTHER, default_create, default_update, skew_get, default_destroy}, + {N_("S.E. Skew"), "SESKEW", PIVOT_RC_OTHER, default_create, default_update, seskew_get, default_destroy}, {N_("First"), "FIRST", NULL , first_create, first_update, first_get, simple_destroy}, {N_("Last"), "LAST", NULL , last_create, last_update, last_get, simple_destroy}, #if 0 diff --git a/src/language/stats/means.c b/src/language/stats/means.c index 94ee1d1956..40ee4a9035 100644 --- a/src/language/stats/means.c +++ b/src/language/stats/means.c @@ -775,18 +775,17 @@ means_shipout_multivar (const struct mtable *mt, const struct means *means, ds_init_empty (&dss); for (int dv = 0; dv < mt->n_dep_vars; ++dv) { - ds_put_cstr (&dss, var_get_name (mt->dep_vars[dv])); - if (mt->n_layers > 0) + if (dv > 0) ds_put_cstr (&dss, " * "); + ds_put_cstr (&dss, var_get_name (mt->dep_vars[dv])); } for (int l = 0; l < mt->n_layers; ++l) { + ds_put_cstr (&dss, " * "); const struct layer *layer = mt->layers[l]; const struct variable *var = layer->factor_vars[ws->control_idx[l]]; ds_put_cstr (&dss, var_get_name (var)); - if (l < mt->n_layers - 1) - ds_put_cstr (&dss, " * "); } struct pivot_table *pt = pivot_table_create (ds_cstr (&dss)); diff --git a/tests/language/stats/means.at b/tests/language/stats/means.at index 8e48319d70..eda5fef177 100644 --- a/tests/language/stats/means.at +++ b/tests/language/stats/means.at @@ -1087,4 +1087,38 @@ N,Mean AT_CLEANUP +dnl Test the output with unusual dependent variable formats +AT_SETUP([MEANS formats]) +AT_KEYWORDS([categorical categoricals]) + +AT_DATA([means-formats.sps], [dnl +data list notable list /hours (TIME11.0) rate (DOLLAR8.2). +begin data +12:00 4.09 +14:01 5.23 +end data. + +means hours rate + /cells = mean count max range. +]) + +AT_CHECK([pspp -O format=csv means-formats.sps], [0], [dnl +Table: Case Processing Summary +,Cases,,,,, +,Included,,Excluded,,Total, +,N,Percent,N,Percent,N,Percent +hours,2,100.0%,0,.0%,2,100.0% +rate,2,100.0%,0,.0%,2,100.0% + +Table: hours * rate +,hours,rate +Mean,13:00:30,$4.66 +N,2,2 +Maximum,14:01:00,$5.23 +Range,02:01:00,$1.14 +]) + +AT_CLEANUP + +