X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fnpar-summary.c;h=2341761fd7df3e7e144da7c14b2311bd76a55440;hb=b4c6c0abd5358cb64757bec30a42be300e9ccd0f;hp=05fa1d02527951bf7ecbf26a724ee76cfe2e8ffe;hpb=dfd1972f7bcb550a4fc3b05dbe7e71d12334b0a7;p=pspp-builds.git diff --git a/src/language/stats/npar-summary.c b/src/language/stats/npar-summary.c index 05fa1d02..2341761f 100644 --- a/src/language/stats/npar-summary.c +++ b/src/language/stats/npar-summary.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2006, 2009 Free Software Foundation, Inc. + Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,6 @@ #include #include #include -#include #include #include "npar-summary.h" #include @@ -37,18 +36,18 @@ npar_summary_calc_descriptives (struct descriptives *desc, struct casereader *input, const struct dictionary *dict, const struct variable *const *vv, - int n_vars UNUSED, + int n_vars, enum mv_class filter) { int i = 0; - while (*vv) + for (i = 0 ; i < n_vars; ++i) { double minimum = DBL_MAX; double maximum = -DBL_MAX; double var; struct moments1 *moments = moments1_create (MOMENT_VARIANCE); struct ccase *c; - const struct variable *v = *vv++; + const struct variable *v = vv[i]; struct casereader *pass; pass = casereader_clone (input); @@ -79,9 +78,8 @@ npar_summary_calc_descriptives (struct descriptives *desc, desc[i].min = minimum; desc[i].max = maximum; - - i++; } + casereader_destroy (input); } @@ -160,11 +158,15 @@ do_summary_box (const struct descriptives *desc, tab_text (table, 0, 2 + v, 0, var_to_string (var)); - tab_double (table, 1, 2 + v, 0, desc[v].n, fmt); - tab_double (table, 2, 2 + v, 0, desc[v].mean, fmt); - tab_double (table, 3, 2 + v, 0, desc[v].std_dev, fmt); - tab_double (table, 4, 2 + v, 0, desc[v].min, fmt); - tab_double (table, 5, 2 + v, 0, desc[v].max, fmt); + col = 1; + if (desc != NULL) + { + tab_double (table, col++, 2 + v, 0, desc[v].n, fmt); + tab_double (table, col++, 2 + v, 0, desc[v].mean, fmt); + tab_double (table, col++, 2 + v, 0, desc[v].std_dev, fmt); + tab_double (table, col++, 2 + v, 0, desc[v].min, fmt); + tab_double (table, col++, 2 + v, 0, desc[v].max, fmt); + } }