struct factor *factor);
static void show_percentiles(struct variable **dependent_var,
- int n_dep_var,
- struct factor *factor);
+ int n_dep_var,
+ struct factor *factor);
/* Represent a factor as a string, so it can be
printed in a human readable fashion */
const char * factor_to_string(const struct factor *fctr,
- struct factor_statistics *fs,
- const struct variable *var);
+ struct factor_statistics *fs,
+ const struct variable *var);
/* Represent a factor as a string, so it can be
multipass_procedure_with_splits (run_examine, &cmd);
if ( totals )
- free( totals );
+ {
+ free( totals );
+ }
if ( dependent_vars )
free (dependent_vars);
-/* Parser for the variables sub command */
+/* Parser for the variables sub command
+ Returns 1 on success */
static int
xmn_custom_variables(struct cmd_examine *cmd )
{
-
lex_match('=');
if ((token != T_ID || dict_lookup_var (default_dict, tokid) == NULL)
&& token != T_ALL)
- return 2;
+ {
+ return 2;
+ }
if (!parse_variables (default_dict, &dependent_vars, &n_dependent_vars,
PV_NO_DUPLICATE | PV_NUMERIC | PV_NO_SCRATCH) )
assert(n_dependent_vars);
totals = xmalloc( sizeof(struct metrics) * n_dependent_vars);
- memset ( totals, 0, sizeof(struct metrics) * n_dependent_vars);
if ( lex_match(T_BY))
{
- return examine_parse_independent_vars(cmd);
+ int success ;
+ success = examine_parse_independent_vars(cmd);
+ if ( success != 1 ) {
+ free (dependent_vars);
+ free (totals) ;
+ }
+ return success;
}
return 1;
static int
examine_parse_independent_vars(struct cmd_examine *cmd)
{
-
+ int success;
struct factor *sf = xmalloc(sizeof(struct factor));
if ((token != T_ID || dict_lookup_var (default_dict, tokid) == NULL)
&& token != T_ALL)
- return 2;
+ {
+ free ( sf ) ;
+ return 2;
+ }
sf->indep_var[0] = parse_variable();
if ((token != T_ID || dict_lookup_var (default_dict, tokid) == NULL)
&& token != T_ALL)
- return 2;
+ {
+ free ( sf ) ;
+ return 2;
+ }
sf->indep_var[1] = parse_variable();
if ( token == '.' || token == '/' )
return 1;
- return examine_parse_independent_vars(cmd);
+ success = examine_parse_independent_vars(cmd);
+
+ if ( success != 1 )
+ free ( sf ) ;
+
+ return success;
}
{
int i;
for ( i = 0 ; i < n_dependent_vars ; ++i )
- metrics_destroy(&totals[i]);
+ {
+ metrics_destroy(&totals[i]);
+ }
}
}
n_rows = n_dep_var * n_factors ;
if ( fctr->indep_var[1] )
- heading_columns = 3;
+ heading_columns = 3;
}
else
{
if ( 0 != compare_values(&prev, &(*fs)->id[0],
fctr->indep_var[0]->width))
{
- tab_text (tbl,
- 1,
- (i * n_factors ) + count +
- heading_rows,
- TAB_LEFT | TAT_TITLE,
- value_to_string(&(*fs)->id[0], fctr->indep_var[0])
- );
-
- if (fctr->indep_var[1] && count > 0 )
- tab_hline(tbl, TAL_1, 1, n_cols - 1,
- (i * n_factors ) + count + heading_rows);
+ tab_text (tbl,
+ 1,
+ (i * n_factors ) + count +
+ heading_rows,
+ TAB_LEFT | TAT_TITLE,
+ value_to_string(&(*fs)->id[0], fctr->indep_var[0])
+ );
+
+ if (fctr->indep_var[1] && count > 0 )
+ tab_hline(tbl, TAL_1, 1, n_cols - 1,
+ (i * n_factors ) + count + heading_rows);
}
n_rows = n_dep_var * 2 * n_extremities * n_factors;
if ( fctr->indep_var[1] )
- heading_columns = 3;
+ heading_columns = 3;
}
else
{
cn->num, 8, 0);
if ( cn->next )
- cn = cn->next;
+ cn = cn->next;
}
cn->num, 8, 0);
if ( cn->next )
- cn = cn->next;
+ cn = cn->next;
}
n_rows = n_dep_var * n_stat_rows * n_factors;
if ( fctr->indep_var[1] )
- heading_columns = 5;
+ heading_columns = 5;
}
else
{
);
populate_descriptives(tbl, heading_columns - 2,
- row, &(*fs)->m[i]);
+ row, &(*fs)->m[i]);
count++ ;
fs++;
int n_factors = 0;
int f=0;
for ( fs = fctr->fs ; *fs ; ++fs )
- ++n_factors;
+ ++n_factors;
chart_write_title(ch, _("Boxplot of %s vs. %s"),
var_to_string(vars[i]), var_to_string(fctr->indep_var[0]) );
/* Show the percentiles */
void
show_percentiles(struct variable **dependent_var,
- int n_dep_var,
- struct factor *fctr)
+ int n_dep_var,
+ struct factor *fctr)
{
struct tab_table *tbl;
int i;
ptiles = (*fs)->m[0].ptile_hash;
if ( fctr->indep_var[1] )
- n_heading_columns = 4;
+ n_heading_columns = 4;
}
else
{
populate_percentiles(tbl, n_heading_columns - 1,
- row, &(*fs)->m[i]);
+ row, &(*fs)->m[i]);
count++ ;
else
{
populate_percentiles(tbl, n_heading_columns - 1,
- i * n_stat_rows * n_factors + n_heading_rows,
- &totals[i]);
+ i * n_stat_rows * n_factors + n_heading_rows,
+ &totals[i]);
}
const char *
factor_to_string_concise(const struct factor *fctr,
- struct factor_statistics *fs)
+ struct factor_statistics *fs)
{