Added result_class parameter to tab_double and updated all callers. Removed tab_fixed
[pspp] / src / language / stats / median.c
index 2db57ab76f025df50ee42797074981e2e09cfa7e..20e414259fd42d573b76e92595ccd4305bc21c64 100644 (file)
@@ -21,7 +21,7 @@
 #include <gsl/gsl_cdf.h>
 
 #include "data/format.h"
-#include "libpspp/cast.h"
+
 
 #include "data/variable.h"
 #include "data/case.h"
 #include "data/casereader.h"
 #include "data/casewriter.h"
 #include "data/subcase.h"
+#include "data/value.h"
 
-
-#include "data/casereader.h"
 #include "math/percentiles.h"
-
 #include "math/sort.h"
 
+#include "libpspp/cast.h"
 #include "libpspp/hmap.h"
 #include "libpspp/array.h"
 #include "libpspp/str.h"
-#include "data/value.h"
 #include "libpspp/misc.h"
 
 #include "output/tab.h"
@@ -199,7 +197,6 @@ median_execute (const struct dataset *ds,
 
          if ( var_is_value_missing (var, case_data (c, var), exclude))
            {
-             case_unref (c);
              continue;
            }
 
@@ -213,7 +210,6 @@ median_execute (const struct dataset *ds,
                  value_compare_3way (indep_val, &nst->val2, width) > 0
                   )
                {
-                 case_unref (c);
                  continue;
                }
            }
@@ -317,6 +313,7 @@ show_frequencies (const struct n_sample_test *nst, const struct results *results
   const int nr = column_headers + nst->n_vars * 2;
     
   struct tab_table *table = tab_create (nc, nr);
+  tab_set_format (table, RC_WEIGHT, wfmt);
 
   tab_headers (table, row_headers, 0, column_headers, 0);
 
@@ -377,10 +374,10 @@ show_frequencies (const struct n_sample_test *nst, const struct results *results
        {
          const struct val_node *vn = rs->sorted_array[i];
          tab_double (table, row_headers + i, column_headers + v * 2,
-                     0, vn->gt, wfmt);
+                     0, vn->gt, NULL, RC_WEIGHT);
 
          tab_double (table, row_headers + i, column_headers + v * 2 + 1,
-                   0, vn->le, wfmt);
+                     0, vn->le, NULL, RC_WEIGHT);
        }
     }
 
@@ -405,6 +402,7 @@ show_test_statistics (const struct n_sample_test *nst,
   const int nr = column_headers + nst->n_vars;
     
   struct tab_table *table = tab_create (nc, nr);
+  tab_set_format (table, RC_WEIGHT, wfmt);
 
   tab_headers (table, row_headers, 0, column_headers, 0);
 
@@ -442,19 +440,19 @@ show_test_statistics (const struct n_sample_test *nst,
 
 
       tab_double (table, row_headers + 0, column_headers + v,
-                 0, rs->n, wfmt);
+                 0, rs->n, NULL, RC_WEIGHT);
 
       tab_double (table, row_headers + 1, column_headers + v,
-                 0, rs->median, NULL);
+                 0, rs->median, NULL, RC_OTHER);
 
       tab_double (table, row_headers + 2, column_headers + v,
-                 0, rs->chisq, NULL);
+                 0, rs->chisq, NULL, RC_OTHER);
 
       tab_double (table, row_headers + 3, column_headers + v,
-                 0, df, wfmt);
+                 0, df, NULL, RC_WEIGHT);
 
       tab_double (table, row_headers + 4, column_headers + v,
-                 0, gsl_cdf_chisq_Q (rs->chisq, df), NULL);
+                 0, gsl_cdf_chisq_Q (rs->chisq, df), NULL, RC_PVALUE);
     }
   
   tab_submit (table);