public Table createTable() { return new Table(); }
/** Make a copy of the current table */ public Table copy() { return new Table(rows()); }
public Table loadTable(String filename, String options) { try { String ext = checkExtension(filename); if (ext != null) { if (ext.equals("csv") || ext.equals("tsv")) { if (options == null) { options = ext; } else { options = ext + "," + options; } } } return new Table(createInput(filename), options); } catch (IOException e) { e.printStackTrace(); return null; } }
public Table typedParse(InputStream input, String options) throws IOException { Table table = new Table(); table.setColumnTypes(this); table.parse(input, options); return table; }
public Table typedParse(InputStream input, String options) throws IOException { Table table = new Table(); table.setColumnTypes(this); table.parse(input, options); return table; }
return null; return new Table(input, optionStr);
public Table getProfile(ArrayList<Variable> selvars) { Table prof = new Table(); prof.setColumnCount(3); prof.setColumnType(0, Table.STRING); prof.setColumnType(1, Table.STRING); prof.setColumnType(2, Table.FLOAT); for (Variable var: selvars) { int idx = getColumn(var); if (idx == -1) continue; TableRow row = prof.addRow(); row.setString(0, var.getName()); row.setString(1, var.getAlias()); row.setFloat(2, getScore(getColumn(var))); } return prof; }
protected Table createSubset(int[] rowSubset) { Table newbie = new Table(); newbie.setColumnTitles(columnTitles); // also sets columns.length newbie.columnTypes = columnTypes; newbie.setRowCount(rowSubset.length); for (int i = 0; i < rowSubset.length; i++) { int row = rowSubset[i]; for (int col = 0; col < columns.length; col++) { switch (columnTypes[col]) { case STRING: newbie.setString(i, col, getString(row, col)); break; case INT: newbie.setInt(i, col, getInt(row, col)); break; case LONG: newbie.setLong(i, col, getLong(row, col)); break; case FLOAT: newbie.setFloat(i, col, getFloat(row, col)); break; case DOUBLE: newbie.setDouble(i, col, getDouble(row, col)); break; } } } return newbie; }
protected Table createSubset(int[] rowSubset) { Table newbie = new Table(); newbie.setColumnTitles(columnTitles); // also sets columns.length newbie.columnTypes = columnTypes; newbie.setRowCount(rowSubset.length); for (int i = 0; i < rowSubset.length; i++) { int row = rowSubset[i]; for (int col = 0; col < columns.length; col++) { switch (columnTypes[col]) { case STRING: newbie.setString(i, col, getString(row, col)); break; case INT: newbie.setInt(i, col, getInt(row, col)); break; case LONG: newbie.setLong(i, col, getLong(row, col)); break; case FLOAT: newbie.setFloat(i, col, getFloat(row, col)); break; case DOUBLE: newbie.setDouble(i, col, getDouble(row, col)); break; } } } return newbie; }