- const struct variable *weight = dict_get_weight (dict);
- const struct fmt_spec *wfmt = weight ? var_get_print_format (weight) : &F_8_0;
-
- int i;
- int v;
-
- const int row_headers = 2;
- const int column_headers = 2;
- const int nc = row_headers + n_vals;
- const int nr = column_headers + nst->n_vars * 2;
-
- struct tab_table *table = tab_create (nc, nr);
-
- tab_headers (table, row_headers, 0, column_headers, 0);
-
- tab_title (table, _("Frequencies"));
-
- /* Box around the table and vertical lines inside*/
- tab_box (table, TAL_2, TAL_2, -1, TAL_1,
- 0, 0, tab_nc (table) - 1, tab_nr (table) - 1 );
-
- tab_hline (table, TAL_2, 0, tab_nc (table) -1, column_headers);
- tab_vline (table, TAL_2, row_headers, 0, tab_nr (table) - 1);
-
- tab_joint_text (table,
- row_headers, 0, row_headers + n_vals - 1, 0,
- TAT_TITLE | TAB_CENTER, var_to_string (nst->indep_var));
-
-
- tab_hline (table, TAL_1, row_headers, tab_nc (table) - 1, 1);
-
-
- for (i = 0; i < n_vals; ++i)
- {
- const struct results *rs = results + 0;
- struct string label;
- ds_init_empty (&label);
-
- var_append_value_name (nst->indep_var, &rs->sorted_array[i]->val,
- &label);
-
- tab_text (table, row_headers + i, 1,
- TAT_TITLE | TAB_LEFT, ds_cstr (&label));
-
- ds_destroy (&label);
- }
-
- for (v = 0; v < nst->n_vars; ++v)
+ struct pivot_table *table = pivot_table_create (N_("Frequencies"));
+ pivot_table_set_weight_var (table, dict_get_weight (dict));
+
+ struct pivot_dimension *indep = pivot_dimension_create__ (
+ table, PIVOT_AXIS_COLUMN, pivot_value_new_variable (nst->indep_var));
+ indep->root->show_label = true;
+ for (int i = 0; i < n_vals; ++i)
+ pivot_category_create_leaf_rc (
+ indep->root, pivot_value_new_var_value (
+ nst->indep_var, &results->sorted_array[i]->val), PIVOT_RC_COUNT);
+ pivot_dimension_create (table, PIVOT_AXIS_ROW, N_("Statistics"),
+ N_("> Median"), N_("≤ Median"));
+
+ struct pivot_dimension *dep = pivot_dimension_create (
+ table, PIVOT_AXIS_ROW, N_("Dependent Variables"));
+
+ for (int v = 0; v < nst->n_vars; ++v)