From 8d9fc72f4f9cf0bf5bbcb80bb020592cf9496a97 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sat, 14 Aug 2010 13:46:39 +0200 Subject: [PATCH] Oneway: Remove group_values struct from show_contrast_coeffs --- src/language/stats/oneway.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/language/stats/oneway.c b/src/language/stats/oneway.c index da4669bcd8..2423215f3a 100644 --- a/src/language/stats/oneway.c +++ b/src/language/stats/oneway.c @@ -923,10 +923,10 @@ show_contrast_coeffs (const struct oneway_spec *cmd, struct oneway_workspace *ws int n_cols = 2 + ws->actual_number_of_groups; int n_rows = 2 + n_contrasts; - void *const *group_values; - struct tab_table *t; + const struct covariance *cov = ws->vws[0].cov ; + t = tab_create (n_cols, n_rows); tab_headers (t, 2, 0, 2, 0); @@ -962,31 +962,27 @@ show_contrast_coeffs (const struct oneway_spec *cmd, struct oneway_workspace *ws tab_joint_text (t, 2, 0, n_cols - 1, 0, TAB_CENTER | TAT_TITLE, var_to_string (cmd->indep_var)); - group_values = hsh_sort (ws->group_hash); - for ( cli = ll_head (&cmd->contrast_list); cli != ll_null (&cmd->contrast_list); cli = ll_next (cli)) { int count = 0; struct contrasts_node *cn = ll_data (cli, struct contrasts_node, ll); - struct ll *coeffi = ll_head (&cn->coefficient_list); + struct ll *coeffi ; tab_text_format (t, 1, c_num + 2, TAB_CENTER, "%d", c_num + 1); - for (count = 0; - count < hsh_count (ws->group_hash) && coeffi != ll_null (&cn->coefficient_list); - ++count) + for (coeffi = ll_head (&cn->coefficient_list); + coeffi != ll_null (&cn->coefficient_list); + ++count, coeffi = ll_next (coeffi)) { - double *group_value_p; - union value group_value; + const struct categoricals *cats = covariance_get_categoricals (cov); + const union value *val = categoricals_get_value_by_subscript (cats, count); struct string vstr; ds_init_empty (&vstr); - group_value_p = group_values[count]; - group_value.f = *group_value_p; - var_append_value_name (cmd->indep_var, &group_value, &vstr); + var_append_value_name (cmd->indep_var, val, &vstr); tab_text (t, count + 2, 1, TAB_CENTER | TAT_TITLE, ds_cstr (&vstr)); @@ -1000,8 +996,6 @@ show_contrast_coeffs (const struct oneway_spec *cmd, struct oneway_workspace *ws tab_text_format (t, count + 2, c_num + 2, TAB_RIGHT, "%g", coeffn->coeff); } - - coeffi = ll_next (coeffi); } ++c_num; } -- 2.30.2