- tab_title (t, "%s", var_to_string (v));
- tab_submit (t);
-}
-
-/* Sets the widths of all the columns and heights of all the rows in
- table T for driver D. */
-static void
-condensed_dim (struct tab_rendering *r, void *aux UNUSED)
-{
- struct outp_driver *d = r->driver;
- const struct tab_table *t = r->table;
-
- int cum_width = outp_string_width (d, _("Cum"), OUTP_PROPORTIONAL);
- int zeros_width = outp_string_width (d, "000", OUTP_PROPORTIONAL);
- int max_width = MAX (cum_width, zeros_width);
-
- int i;
-
- for (i = 0; i < 2; i++)
- {
- r->w[i] = tab_natural_width (r, i);
- r->w[i] = MAX (r->w[i], d->prop_em_width * 8);
- }
- for (i = 2; i < 4; i++)
- r->w[i] = max_width;
- for (i = 0; i < t->nr; i++)
- r->h[i] = d->font_height;
-}
-
-/* Display condensed frequency table for variable V. */
-static void
-dump_condensed (const struct variable *v, const struct variable *wv)
-{
- const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : &F_8_0;
- int n_categories;
- struct var_freqs *vf;
- struct freq_tab *ft;
- struct freq_mutable *f;
- struct tab_table *t;
- int r;
- double cum_total = 0.0;
-
- vf = get_var_freqs (v);
- ft = &vf->tab;
- n_categories = ft->n_valid + ft->n_missing;
- t = tab_create (4, n_categories + 2, 0);
-
- tab_headers (t, 0, 0, 2, 0);
- tab_text (t, 0, 1, TAB_CENTER | TAT_TITLE, _("Value"));
- tab_text (t, 1, 1, TAB_CENTER | TAT_TITLE, _("Freq"));
- tab_text (t, 2, 1, TAB_CENTER | TAT_TITLE, _("Pct"));
- tab_text (t, 3, 0, TAB_CENTER | TAT_TITLE, _("Cum"));
- tab_text (t, 3, 1, TAB_CENTER | TAT_TITLE, _("Pct"));
- tab_dim (t, condensed_dim, NULL, NULL);
-
- r = 2;
- for (f = ft->valid; f < ft->missing; f++)
- {
- double percent;
-
- percent = f->count / ft->total_cases * 100.0;
- cum_total += f->count / ft->valid_cases * 100.0;
-
- tab_value (t, 0, r, TAB_NONE, &f->value, &vf->print);
- tab_double (t, 1, r, TAB_NONE, f->count, wfmt);
- tab_double (t, 2, r, TAB_NONE, percent, NULL);
- tab_double (t, 3, r, TAB_NONE, cum_total, NULL);
- r++;
- }
- for (; f < &ft->valid[n_categories]; f++)
- {
- tab_value (t, 0, r, TAB_NONE, &f->value, &vf->print);
- tab_double (t, 1, r, TAB_NONE, f->count, wfmt);
- tab_double (t, 2, r, TAB_NONE,
- f->count / ft->total_cases * 100.0, NULL);
- r++;
- }
-
- tab_box (t, TAL_1, TAL_1,
- cmd.spaces == FRQ_SINGLE ? -1 : TAL_GAP, TAL_1,
- 0, 0, 3, r - 1);
- tab_hline (t, TAL_2, 0, 3, 2);
- tab_title (t, "%s", var_to_string (v));
- tab_columns (t, SOM_COL_DOWN);