LOGISTIC REGRESSION: Allow fractional confidence interval
[pspp] / src / language / stats / rank.c
index 19861cc0904e05aa7cf5635ac197bd7653c8706f..a29a3fd11f7870a746b1d26c06d8a63eaae96690 100644 (file)
@@ -589,22 +589,9 @@ rank_sorted_file (struct casereader *input,
 }
 
 
-/* Transformation function to enumerate all the cases */
-static int
-create_resort_key (void *key_var_, struct ccase **cc, casenumber case_num)
-{
-  struct variable *key_var = key_var_;
-
-  *cc = case_unshare (*cc);
-  case_data_rw (*cc, key_var)->f = case_num;
-
-  return TRNS_CONTINUE;
-}
-
 static bool
 rank_cmd (struct dataset *ds,  const struct rank *cmd);
 
-
 static const char *
 fraction_name (const struct rank *cmd)
 {
@@ -797,8 +784,8 @@ cmd_rank (struct lexer *lexer, struct dataset *ds)
 
       rs = pool_calloc (rank.pool, 1, sizeof *rs);
       rs->rfunc = RANK;
-      rs->dest_names = pool_calloc (rank.pool, 1, sizeof *rs->dest_names);
-      rs->dest_labels = pool_calloc (rank.pool, 1, sizeof *rs->dest_labels);
+      rs->dest_names = pool_calloc (rank.pool, rank.n_vars,
+                                    sizeof *rs->dest_names);
 
       rank.rs = rs;
       rank.n_rs = 1;
@@ -1000,11 +987,7 @@ rank_cmd (struct dataset *ds, const struct rank *cmd)
   bool ok = true;
   int i;
 
-  /* Add a variable which we can sort by to get back the original
-     order */
-  order_var = dict_create_var_assert (dataset_dict (ds), "$ORDER", 0);
-
-  add_transformation (ds, create_resort_key, 0, order_var);
+  order_var = add_permanent_ordering_transformation (ds);
 
   /* Create output files. */
   {