code: public static Vec toCategoricalVec(Vec src) {
      switch (src.get_type()) {
        case Vec.T_CAT:
          return src.makeCopy(src.domain());
        case Vec.T_NUM:
          return numericToCategorical(src);
        case Vec.T_STR: // PUBDEV-2204
          return stringToCategorical(src);
        case Vec.T_TIME: // PUBDEV-2205
          throw new H2OIllegalArgumentException("Changing time/date columns to a categorical"
              + " column has not been implemented yet.");
        case Vec.T_UUID:
          throw new H2OIllegalArgumentException("Changing UUID columns to a categorical"
              + " column has not been implemented yet.");
        default:
          throw new H2OIllegalArgumentException("Unrecognized column type " + src.get_type_str()
              + " given to toCategoricalVec()");
      }
    }
docs: Create a new {@link Vec} of categorical values from an existing {@link Vec}.
  
  This method accepts all {@link Vec} types as input. The original Vec is not mutated.
  
  If src is a categorical {@link Vec}, a copy is returned.
  
  If src is a numeric {@link Vec}, the values are converted to strings used as domain
  values.
  
  For all other types, an exception is currently thrown. These need to be replaced
  with appropriate conversions.
  
  Throws H2OIllegalArgumentException() if the resulting domain exceeds
  Categorical.MAX_CATEGORICAL_COUNT.
  
  @param src A {@link Vec} whose values will be used as the basis for a new categorical {@link Vec}
  @return the resulting categorical Vec