code: public AttributeDataset columns(String... cols) {
          Attribute[] attrs = new Attribute[cols.length];
          int[] index = new int[cols.length];
          for (int k = 0; k < cols.length; k++) {
              for (int j = 0; j < attributes.length; j++) {
                  if (attributes[j].getName().equals(cols[k])) {
                      index[k] = j;
                      attrs[k] = attributes[j];
                      break;
                  }
              }
  
              if (attrs[k] == null) {
                  throw new IllegalArgumentException("Unknown column: " + cols[k]);
              }
          }
  
          AttributeDataset sub = new AttributeDataset(name, attrs, response);
          for (Datum<double[]> datum : data) {
              double[] x = new double[index.length];
              for (int i = 0; i < x.length; i++) {
                  x[i] = datum.x[index[i]];
              }
              Row row = response == null ? sub.add(x) : sub.add(x, datum.y);
              row.name = datum.name;
              row.weight = datum.weight;
              row.description = datum.description;
              row.timestamp = datum.timestamp;
          }
  
          return sub;
      }
docs: Returns a dataset with selected columns.