X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fexamine.q;h=e4239fda6adbbd45695b4350c93e64f7a51ade9b;hb=5424322a9f6fc37dfb09760c779a63460ecf7eb5;hp=acbdf3e0f02d20dfc71a0ff127d8fb3e0693143a;hpb=b46b794dfb9f0758aafec83f50993d1930894099;p=pspp diff --git a/src/language/stats/examine.q b/src/language/stats/examine.q index acbdf3e0f0..e4239fda6a 100644 --- a/src/language/stats/examine.q +++ b/src/language/stats/examine.q @@ -43,15 +43,14 @@ #include #include #include -#include #include #include #include #include -#include +#include +#include #include -#include -#include +#include #include "minmax.h" #include "xalloc.h" @@ -61,9 +60,7 @@ #define N_(msgid) msgid /* (headers) */ -#include #include -#include #include /* (specification) @@ -339,7 +336,7 @@ show_npplot (const struct variable **dependent_var, struct string label; const struct factor_result *result = ll_data (ll, struct factor_result, ll); - struct chart *npp, *dnpp; + struct chart_item *npp, *dnpp; struct casereader *reader; struct np *np; @@ -357,16 +354,17 @@ show_npplot (const struct variable **dependent_var, if (npp == NULL || dnpp == NULL) { msg (MW, _("Not creating NP plot because data set is empty.")); - chart_unref (npp); - chart_unref (dnpp); + chart_item_unref (npp); + chart_item_unref (dnpp); } else { - chart_submit (npp); - chart_submit (dnpp); + chart_item_submit (npp); + chart_item_submit (dnpp); } statistic_destroy (&np->parent.parent); + casereader_destroy (reader); } } } @@ -406,8 +404,9 @@ show_histogram (const struct variable **dependent_var, moments1_calculate (result->metrics[v].moments, &n, &mean, &var, NULL, NULL); - chart_submit (histogram_chart_create (histogram, ds_cstr (&str), - n, mean, sqrt (var), false)); + chart_item_submit (histogram_chart_create (histogram->gsl_hist, + ds_cstr (&str), n, mean, + sqrt (var), false)); ds_destroy (&str); } @@ -471,7 +470,7 @@ show_boxplot_groups (const struct variable **dependent_var, ds_destroy (&str); } - chart_submit (boxplot_get_chart (boxplot)); + boxplot_submit (boxplot); } } @@ -519,7 +518,7 @@ show_boxplot_variables (const struct variable **dependent_var, metrics->box_whisker = NULL; } - chart_submit (boxplot_get_chart (boxplot)); + boxplot_submit (boxplot); } } @@ -986,11 +985,12 @@ examine_group (struct cmd_examine *cmd, struct casereader *reader, int level, struct factor_metrics *metric = &result->metrics[v]; int n_vals = caseproto_get_n_widths (casereader_get_proto ( metric->up_reader)); - struct order_stats *os = &metric->box_whisker->parent; + struct order_stats *os; metric->box_whisker = box_whisker_create ( metric->tukey_hinges, cmd->v_id, n_vals - 1); + os = &metric->box_whisker->parent; order_stats_accumulate ( &os, 1, casereader_clone (metric->up_reader), wv, dependent_vars[v], MV_ANY); @@ -1131,11 +1131,9 @@ show_summary (const struct variable **dependent_var, int n_dep_var, n_cols = heading_columns + 6; - tbl = tab_create (n_cols, n_rows, 0); + tbl = tab_create (n_cols, n_rows); tab_headers (tbl, heading_columns, 0, heading_rows, 0); - tab_dim (tbl, tab_natural_dimensions, NULL, NULL); - /* Outline the box */ tab_box (tbl, TAL_2, TAL_2, @@ -1294,10 +1292,10 @@ show_summary (const struct variable **dependent_var, int n_dep_var, TAB_LEFT, n, wfmt); - tab_text (tbl, heading_columns + 1, - heading_rows + j + v * ll_count (&fctr->result_list), - TAB_RIGHT | TAT_PRINTF, - "%g%%", n * 100.0 / result->metrics[v].n); + tab_text_format (tbl, heading_columns + 1, + heading_rows + j + v * ll_count (&fctr->result_list), + TAB_RIGHT, + "%g%%", n * 100.0 / result->metrics[v].n); /* Total Missing */ tab_double (tbl, heading_columns + 2, @@ -1306,12 +1304,12 @@ show_summary (const struct variable **dependent_var, int n_dep_var, result->metrics[v].n - n, wfmt); - tab_text (tbl, heading_columns + 3, - heading_rows + j + v * ll_count (&fctr->result_list), - TAB_RIGHT | TAT_PRINTF, - "%g%%", - (result->metrics[v].n - n) * 100.0 / result->metrics[v].n - ); + tab_text_format (tbl, heading_columns + 3, + heading_rows + j + v * ll_count (&fctr->result_list), + TAB_RIGHT, + "%g%%", + (result->metrics[v].n - n) * 100.0 / result->metrics[v].n + ); /* Total Valid + Missing */ tab_double (tbl, heading_columns + 4, @@ -1320,12 +1318,12 @@ show_summary (const struct variable **dependent_var, int n_dep_var, result->metrics[v].n, wfmt); - tab_text (tbl, heading_columns + 5, - heading_rows + j + v * ll_count (&fctr->result_list), - TAB_RIGHT | TAT_PRINTF, - "%g%%", - (result->metrics[v].n) * 100.0 / result->metrics[v].n - ); + tab_text_format (tbl, heading_columns + 5, + heading_rows + j + v * ll_count (&fctr->result_list), + TAB_RIGHT, + "%g%%", + ((result->metrics[v].n) * 100.0 + / result->metrics[v].n)); ++j; } @@ -1368,11 +1366,9 @@ show_descriptives (const struct variable **dependent_var, n_cols = heading_columns + 2; - tbl = tab_create (n_cols, n_rows, 0); + tbl = tab_create (n_cols, n_rows); tab_headers (tbl, heading_columns, 0, heading_rows, 0); - tab_dim (tbl, tab_natural_dimensions, NULL, NULL); - /* Outline the box */ tab_box (tbl, TAL_2, TAL_2, @@ -1447,11 +1443,11 @@ show_descriptives (const struct variable **dependent_var, TAB_LEFT, _("Mean")); - tab_text (tbl, n_cols - 4, - heading_rows + row_var_start + 1 + i * DESCRIPTIVE_ROWS, - TAB_LEFT | TAT_PRINTF, - _("%g%% Confidence Interval for Mean"), - cmd.n_cinterval[0]); + tab_text_format (tbl, n_cols - 4, + heading_rows + row_var_start + 1 + i * DESCRIPTIVE_ROWS, + TAB_LEFT, + _("%g%% Confidence Interval for Mean"), + cmd.n_cinterval[0]); tab_text (tbl, n_cols - 3, heading_rows + row_var_start + 1 + i * DESCRIPTIVE_ROWS, @@ -1464,9 +1460,8 @@ show_descriptives (const struct variable **dependent_var, _("Upper Bound")); tab_text (tbl, n_cols - 4, - heading_rows + row_var_start + 3 + i * DESCRIPTIVE_ROWS, - TAB_LEFT | TAT_PRINTF, - _("5%% Trimmed Mean")); + heading_rows + row_var_start + 3 + i * DESCRIPTIVE_ROWS, + TAB_LEFT, _("5% Trimmed Mean")); tab_text (tbl, n_cols - 4, heading_rows + row_var_start + 4 + i * DESCRIPTIVE_ROWS, @@ -1681,11 +1676,9 @@ show_extremes (const struct variable **dependent_var, n_cols = heading_columns + 2; - tbl = tab_create (n_cols, n_rows, 0); + tbl = tab_create (n_cols, n_rows); tab_headers (tbl, heading_columns, 0, heading_rows, 0); - tab_dim (tbl, tab_natural_dimensions, NULL, NULL); - /* Outline the box */ tab_box (tbl, TAL_2, TAL_2, @@ -1737,15 +1730,15 @@ show_extremes (const struct variable **dependent_var, for ( e = 1; e <= cmd.st_n; ++e ) { - tab_text (tbl, n_cols - 3, - heading_rows + row_var_start + row_result_start + e - 1, - TAB_RIGHT | TAT_PRINTF, - _("%d"), e); - - tab_text (tbl, n_cols - 3, - heading_rows + row_var_start + row_result_start + cmd.st_n + e - 1, - TAB_RIGHT | TAT_PRINTF, - _("%d"), e); + tab_text_format (tbl, n_cols - 3, + heading_rows + row_var_start + row_result_start + e - 1, + TAB_RIGHT, + "%d", e); + + tab_text_format (tbl, n_cols - 3, + heading_rows + row_var_start + row_result_start + cmd.st_n + e - 1, + TAB_RIGHT, + "%d", e); } @@ -1776,7 +1769,6 @@ show_extremes (const struct variable **dependent_var, min_ll = ll_next (min_ll); } - max_ll = ll_head (extrema_list (result->metrics[v].maxima)); for (e = 0; e < cmd.st_n;) { @@ -1886,11 +1878,9 @@ show_percentiles (const struct variable **dependent_var, n_cols = heading_columns + n_percentiles; - tbl = tab_create (n_cols, n_rows, 0); + tbl = tab_create (n_cols, n_rows); tab_headers (tbl, heading_columns, 0, heading_rows, 0); - tab_dim (tbl, tab_natural_dimensions, NULL, NULL); - /* Outline the box */ tab_box (tbl, TAL_2, TAL_2, @@ -2008,11 +1998,10 @@ show_percentiles (const struct variable **dependent_var, for (i = 0 ; i < n_percentiles; ++i ) { - tab_text (tbl, n_cols - n_percentiles + i, 1, - TAB_CENTER | TAT_TITLE | TAT_PRINTF, - _("%g"), - subc_list_double_at (&percentile_list, i) - ); + tab_text_format (tbl, n_cols - n_percentiles + i, 1, + TAB_CENTER | TAT_TITLE, + _("%g"), + subc_list_double_at (&percentile_list, i)); }