refactor
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 14 Aug 2022 06:06:59 +0000 (23:06 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 14 Aug 2022 06:06:59 +0000 (23:06 -0700)
src/language/stats/ctables.c

index aeae6223fc45db75643f608772fc39b3a4392db0..6337366acbcd7efe3521e4fb7b5a2f37451879ed 100644 (file)
@@ -4712,11 +4712,10 @@ ctables_prepare_table (struct ctables_table *t)
                       n_drop = a != PIVOT_AXIS_LAYER;
                     else if (t->clabels_to_axis != PIVOT_AXIS_LAYER)
                       n_drop = a == t->clabels_from_axis ? 2 : 0;
+                    else if (a != PIVOT_AXIS_LAYER && a != t->clabels_from_axis)
+                      n_drop = 1;
                     else
-                      {
-                        n_drop = a != PIVOT_AXIS_LAYER && a != t->clabels_from_axis;
-                        drop_inner = a == t->clabels_from_axis;
-                      }
+                      drop_inner = a == t->clabels_from_axis;
                     break;
 
                   case CTAT_LAYERROW:
@@ -4728,22 +4727,17 @@ ctables_prepare_table (struct ctables_table *t)
                   case CTAT_COL:
                     if (a == atb)
                       {
-                        if (t->label_axis[ata] == atb)
-                          ;
-                        else if (t->label_axis[atb] == ata)
-                          drop_inner = true;
-                        else if (t->label_axis[atb] == PIVOT_AXIS_LAYER)
+                        if (t->clabels_from_axis == atb)
                           drop_inner = true;
-                        else
+                        else if (t->clabels_to_axis != atb)
                           n_drop = 1;
                       }
-                    if (a == ata && t->label_axis[ata] == atb)
-                      n_drop++;
+                    else if (a == ata)
+                      n_drop = t->label_axis[ata] == atb;
                     break;
 
                   case CTAT_LAYER:
                   case CTAT_TABLE:
-                    n_drop = 0;
                     break;
                   }