code: private int countNumberOfAggregates(Frame fr, int numberOfColumns, AstRoot asts[]) {
      int validGroupByCols = 0;
      for (int idx=3; idx < asts.length; idx+=3) {  // initial loop to count operations on valid columns, ignore String columns
        AstNumList col = check(numberOfColumns, asts[idx + 1]);
        if (col.cnt() != 1) throw new IllegalArgumentException("Group-By functions take only a single column");
        int agg_col = (int) col.min(); // Aggregate column
        if (fr.vec(agg_col).isString()) {
          Log.warn("Column "+fr._names[agg_col]+" is a string column.  Groupby operations will be skipped for this column.");
        } else
          validGroupByCols++;
      }
      return validGroupByCols;
    }
docs: Count of aggregates; knock off the first 4 ASTs (GB data [group-by] [order-by]...), then count by triples.