From aa937be5e1ac11fadf7a3c6705416f9b4ad35c1f Mon Sep 17 00:00:00 2001 From: John Darrington Date: Fri, 17 Jul 2009 23:11:44 +0800 Subject: [PATCH] Ensure correct behaviour when the state var is missing. When the state variable is missing, then the entire case is skipped. --- src/language/stats/roc.c | 11 +++++++++-- tests/command/roc.sh | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/language/stats/roc.c b/src/language/stats/roc.c index 0709992c..1e8ac4e0 100644 --- a/src/language/stats/roc.c +++ b/src/language/stats/roc.c @@ -49,7 +49,7 @@ struct cmd_roc const struct variable **vars; const struct dictionary *dict; - struct variable *state_var ; + const struct variable *state_var ; union value state_value; /* Plot the roc curve */ @@ -640,14 +640,21 @@ do_roc (struct cmd_roc *roc, struct casereader *reader, struct dictionary *dict) struct subcase up_ordering; struct subcase down_ordering; + struct casewriter *neg_wtr = NULL; + struct casereader *input = casereader_create_filter_missing (reader, roc->vars, roc->n_vars, roc->exclude, NULL, NULL); + input = casereader_create_filter_missing (input, + &roc->state_var, 1, + roc->exclude, + NULL, + NULL); - struct casewriter *neg_wtr = autopaging_writer_create (casereader_get_proto (input)); + neg_wtr = autopaging_writer_create (casereader_get_proto (input)); prepare_cutpoints (roc, rs, input); diff --git a/tests/command/roc.sh b/tests/command/roc.sh index 57dad752..0c24f0c5 100755 --- a/tests/command/roc.sh +++ b/tests/command/roc.sh @@ -73,6 +73,7 @@ begin data. 4 2 14 1 4 3 2 0 5 4 20 1 +5 4 20 . 5 5 1 0 end data. -- 2.30.2