projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge 'master' into 'psppsheet'.
[pspp]
/
src
/
language
/
stats
/
examine.c
diff --git
a/src/language/stats/examine.c
b/src/language/stats/examine.c
index 0cef962827a3c3840d69e3af292e2a6e6f191154..46b27f9d360ac34b1161a69de910aadb18eaba43 100644
(file)
--- a/
src/language/stats/examine.c
+++ b/
src/language/stats/examine.c
@@
-66,6
+66,14
@@
#define _(msgid) gettext (msgid)
#define N_(msgid) msgid
#define _(msgid) gettext (msgid)
#define N_(msgid) msgid
+static void
+append_value_name (const struct variable *var, const union value *val, struct string *str)
+{
+ var_append_value_name (var, val, str);
+ if ( var_is_value_missing (var, val, MV_ANY))
+ ds_put_cstr (str, _(" (missing)"));
+}
+
enum bp_mode
{
BP_GROUPS,
enum bp_mode
{
BP_GROUPS,
@@
-96,7
+104,8
@@
struct examine
size_t n_iacts;
struct interaction **iacts;
size_t n_iacts;
struct interaction **iacts;
- enum mv_class exclude;
+ enum mv_class dep_excl;
+ enum mv_class fctr_excl;
const struct dictionary *dict;
const struct dictionary *dict;
@@
-300,7
+309,7
@@
show_boxplot_grouped (const struct examine *cmd, int iact_idx)
ds_put_cstr (&label, var_to_string (ivar));
ds_put_cstr (&label, " = ");
ds_put_cstr (&label, var_to_string (ivar));
ds_put_cstr (&label, " = ");
-
var_
append_value_name (ivar, val, &label);
+ append_value_name (ivar, val, &label);
ds_put_cstr (&label, "; ");
}
ds_put_cstr (&label, "; ");
}
@@
-359,7
+368,7
@@
show_boxplot_variabled (const struct examine *cmd, int iact_idx)
ds_put_cstr (&label, var_to_string (ivar));
ds_put_cstr (&label, " = ");
ds_put_cstr (&label, var_to_string (ivar));
ds_put_cstr (&label, " = ");
-
var_
append_value_name (ivar, val, &label);
+ append_value_name (ivar, val, &label);
ds_put_cstr (&label, "; ");
}
ds_put_cstr (&label, "; ");
}
@@
-426,7
+435,7
@@
show_npplot (const struct examine *cmd, int iact_idx)
ds_put_cstr (&label, var_to_string (ivar));
ds_put_cstr (&label, " = ");
ds_put_cstr (&label, var_to_string (ivar));
ds_put_cstr (&label, " = ");
-
var_
append_value_name (ivar, val, &label);
+ append_value_name (ivar, val, &label);
ds_put_cstr (&label, "; ");
}
ds_put_cstr (&label, "; ");
}
@@
-551,7
+560,7
@@
show_histogram (const struct examine *cmd, int iact_idx)
ds_put_cstr (&label, var_to_string (ivar));
ds_put_cstr (&label, " = ");
ds_put_cstr (&label, var_to_string (ivar));
ds_put_cstr (&label, " = ");
-
var_
append_value_name (ivar, val, &label);
+ append_value_name (ivar, val, &label);
ds_put_cstr (&label, "; ");
}
ds_put_cstr (&label, "; ");
}
@@
-676,7
+685,7
@@
percentiles_report (const struct examine *cmd, int iact_idx)
{
struct string str;
ds_init_empty (&str);
{
struct string str;
ds_init_empty (&str);
-
var_
append_value_name (ivar, val, &str);
+ append_value_name (ivar, val, &str);
tab_text (t,
1 + ivar_idx,
tab_text (t,
1 + ivar_idx,
@@
-844,7
+853,7
@@
descriptives_report (const struct examine *cmd, int iact_idx)
{
struct string str;
ds_init_empty (&str);
{
struct string str;
ds_init_empty (&str);
-
var_
append_value_name (ivar, val, &str);
+ append_value_name (ivar, val, &str);
tab_text (t,
1 + ivar_idx,
tab_text (t,
1 + ivar_idx,
@@
-1160,7
+1169,7
@@
extremes_report (const struct examine *cmd, int iact_idx)
{
struct string str;
ds_init_empty (&str);
{
struct string str;
ds_init_empty (&str);
-
var_
append_value_name (ivar, val, &str);
+ append_value_name (ivar, val, &str);
tab_text (t,
1 + ivar_idx,
tab_text (t,
1 + ivar_idx,
@@
-1378,7
+1387,7
@@
summary_report (const struct examine *cmd, int iact_idx)
{
struct string str;
ds_init_empty (&str);
{
struct string str;
ds_init_empty (&str);
-
var_
append_value_name (ivar, val, &str);
+ append_value_name (ivar, val, &str);
tab_text (t,
1 + ivar_idx, heading_rows + n_cats * v + i,
tab_text (t,
1 + ivar_idx, heading_rows + n_cats * v + i,
@@
-1538,7
+1547,7
@@
update_n (const void *aux1, void *aux2 UNUSED, void *user_data,
const struct variable *var = examine->dep_vars[v];
const double x = case_data (c, var)->f;
const struct variable *var = examine->dep_vars[v];
const double x = case_data (c, var)->f;
- if (var_is_value_missing (var, case_data (c, var), examine->
exclude
))
+ if (var_is_value_missing (var, case_data (c, var), examine->
dep_excl
))
{
es[v].missing += weight;
continue;
{
es[v].missing += weight;
continue;
@@
-1596,8
+1605,6
@@
calculate_n (const void *aux1, void *aux2 UNUSED, void *user_data)
/ (1 + log2 (es[v].cc))
;
/ (1 + log2 (es[v].cc))
;
- bin_width = chart_rounded_tick (bin_width);
-
es[v].histogram =
histogram_create (bin_width, es[v].minimum, es[v].maximum);
}
es[v].histogram =
histogram_create (bin_width, es[v].minimum, es[v].maximum);
}
@@
-1796,13
+1803,14
@@
run_examine (struct examine *cmd, struct casereader *input)
struct payload payload;
payload.create = create_n;
payload.update = update_n;
struct payload payload;
payload.create = create_n;
payload.update = update_n;
- payload.destroy = calculate_n;
+ payload.calculate = calculate_n;
+ payload.destroy = NULL;
cmd->wv = dict_get_weight (cmd->dict);
cmd->cats
= categoricals_create (cmd->iacts, cmd->n_iacts,
cmd->wv = dict_get_weight (cmd->dict);
cmd->cats
= categoricals_create (cmd->iacts, cmd->n_iacts,
- cmd->wv, cmd->
exclude
);
+ cmd->wv, cmd->
dep_excl, cmd->fctr_excl
);
categoricals_set_payload (cmd->cats, &payload, cmd, NULL);
categoricals_set_payload (cmd->cats, &payload, cmd, NULL);
@@
-1818,14
+1826,12
@@
run_examine (struct examine *cmd, struct casereader *input)
case_unref (c);
}
case_unref (c);
}
- /* FIXME: Filter out missing factor variables */
-
/* Remove cases on a listwise basis if requested */
if ( cmd->missing_pw == false)
input = casereader_create_filter_missing (input,
cmd->dep_vars,
cmd->n_dep_vars,
/* Remove cases on a listwise basis if requested */
if ( cmd->missing_pw == false)
input = casereader_create_filter_missing (input,
cmd->dep_vars,
cmd->n_dep_vars,
- cmd->
exclude
,
+ cmd->
dep_excl
,
NULL,
NULL);
NULL,
NULL);
@@
-1918,7
+1924,8
@@
cmd_examine (struct lexer *lexer, struct dataset *ds)
examine.iacts = iacts_mem = pool_zalloc (examine.pool, sizeof (struct interaction *));
examine.iacts[0] = interaction_create (NULL);
examine.iacts = iacts_mem = pool_zalloc (examine.pool, sizeof (struct interaction *));
examine.iacts[0] = interaction_create (NULL);
- examine.exclude = MV_ANY;
+ examine.dep_excl = MV_ANY;
+ examine.fctr_excl = MV_ANY;
examine.histogram = false;
examine.npplot = false;
examine.boxplot = false;
examine.histogram = false;
examine.npplot = false;
examine.boxplot = false;
@@
-2102,11
+2109,19
@@
cmd_examine (struct lexer *lexer, struct dataset *ds)
}
else if (lex_match_id (lexer, "EXCLUDE"))
{
}
else if (lex_match_id (lexer, "EXCLUDE"))
{
- examine.
exclude
= MV_ANY;
+ examine.
dep_excl
= MV_ANY;
}
else if (lex_match_id (lexer, "INCLUDE"))
{
}
else if (lex_match_id (lexer, "INCLUDE"))
{
- examine.exclude = MV_SYSTEM;
+ examine.dep_excl = MV_SYSTEM;
+ }
+ else if (lex_match_id (lexer, "REPORT"))
+ {
+ examine.fctr_excl = MV_NEVER;
+ }
+ else if (lex_match_id (lexer, "NOREPORT"))
+ {
+ examine.fctr_excl = MV_ANY;
}
else
{
}
else
{
@@
-2222,6
+2237,7
@@
cmd_examine (struct lexer *lexer, struct dataset *ds)
{
examine.n_iacts--;
examine.iacts = &iacts_mem[1];
{
examine.n_iacts--;
examine.iacts = &iacts_mem[1];
+ interaction_destroy (iacts_mem[0]);
}
}
@@
-2277,9
+2293,6
@@
cmd_examine (struct lexer *lexer, struct dataset *ds)
caseproto_unref (examine.ex_proto);
caseproto_unref (examine.ex_proto);
- for (i = 0; i < examine.n_iacts; ++i)
- interaction_destroy (examine.iacts[i]);
-
free (examine.ptiles);
free (examine.dep_vars);
pool_destroy (examine.pool);
free (examine.ptiles);
free (examine.dep_vars);
pool_destroy (examine.pool);