code: public static Vec numericToCategorical(Vec src) {
      if (src.isInt()) {
        int min = (int) src.min(), max = (int) src.max();
        // try to do the fast domain collection
        long dom[] = (min >= 0 && max < Integer.MAX_VALUE - 4) ? new CollectDomainFast(max).doAll(src).domain() : new CollectIntegerDomain().doAll(src).domain();
        if (dom.length > Categorical.MAX_CATEGORICAL_COUNT)
          throw new H2OIllegalArgumentException("Column domain is too large to be represented as an categorical: " + dom.length + " > " + Categorical.MAX_CATEGORICAL_COUNT);
        return copyOver(src, Vec.T_CAT, dom);
      } else if(src.isNumeric()){
        final double [] dom = new CollectDoubleDomain(null,10000).doAll(src).domain();
        String [] strDom = new String[dom.length];
        for(int i = 0; i < dom.length; ++i)
          strDom[i] = String.valueOf(dom[i]);
        Vec dst = src.makeZero(strDom);
        new MRTask(){
          @Override public void map(Chunk c0, Chunk c1){
            for(int r = 0; r < c0._len; ++r){
              double d = c0.atd(r);
              if(Double.isNaN(d))
                c1.setNA(r);
              else
                c1.set(r,Arrays.binarySearch(dom,d));
            }
          }
        }.doAll(new Vec[]{src,dst});
        assert dst.min() == 0;
        assert dst.max() == dom.length-1;
        return dst;
      } else throw new IllegalArgumentException("calling numericToCategorical conversion on a non numeric column");
    }
docs: Create a new {@link Vec} of categorical values from a numeric {@link Vec}.
  
  This currently only ingests a {@link Vec} of integers.
  
  Handling reals is PUBDEV-2207
  
  @param src a numeric {@link Vec}
  @return a categorical {@link Vec}