protected double getWeightImpl(TableRow row) { if (type == Table.INT) { return row.getInt(index) ; } else if (type == Table.LONG) { return row.getLong(index); } else if (type == Table.FLOAT) { return row.getFloat(index); } else if (type == Table.DOUBLE) { return row.getDouble(index); } else { return 1d; } }
/** * Create a dictionary that maps between column titles and cell entries * in a TableRow. If two columns have the same name, the later column's * values will override the earlier values. */ public StringDict(TableRow row) { this(row.getColumnCount()); String[] titles = row.getColumnTitles(); if (titles == null) { titles = new StringList(IntList.fromRange(row.getColumnCount())).array(); } for (int col = 0; col < row.getColumnCount(); col++) { set(titles[col], row.getString(col)); } // remove unused and overwritten entries crop(); }
public String formatValue(TableRow row) { String value = row.getString(index); if (value == null || value.equals(missingString)) return "missing"; return value; }
int size = table.rows().size(); int[] array = new int[size]; int i = 0; for (TableRow row : table.rows()) { int nums = row.getInt("Column1"); println(nums); array[i] = nums; i++; }
setColumnTypes(incoming.getColumnTypes()); setColumnTitles(incoming.getColumnTitles()); setColumnCount(incoming.getColumnCount());
Variable var = allvars.get(r); TableRow row = dict.getRow(r); int count = row.getColumnCount(); String alias = row.getString(0); var.setAlias(alias); if (2 < count) { String range = row.getString(2); if (range != null && !range.equals("")) var.initValues(range); if (3 < count) { String weight = row.getString(3); if (weight != null && !weight.equals("")) initWeight(var, weight);
Table table; void setup(){ //load the csv file table = loadTable("data.csv"); //loop through each row for (TableRow row : table.rows()) { //extract the first and second value from the current row float x = row.getFloat(0);//extract the first value on the row, at index 0 float y = row.getFloat(1);//extract the second value on the row, at index 1 //use the current x,y values to draw an ellipse ellipse(x,y,5,5); } }
int srcCol = var.getIndex(); String value = var.missing(src) ? project.missString : src.getString(srcCol); dest.setString(destCol, value); destCol++; for (Variable var: selvars) { TableRow dest = dicttab.addRow(); dest.setString(0, var.getAlias()); dest.setString(1, Variable.formatType(var.type())); dest.setString(2, var.formatRange(false));
public Table(Iterable<TableRow> rows) { boolean typed = false; for (TableRow row : rows) { if (!typed) { setColumnTypes(row.getColumnTypes()); } addRow(row); } }
public String formatValue(TableRow row) { String value = row.getString(index); String alias = aliases.get(value); return alias == null ? "missing" : alias; }
List<Integer> myNums = new ArrayList<>(); for (TableRow row : table.rows()) { int nums = row.getInt("Column1"); myNums.add(nums) println(nums); }
public boolean inside(TableRow row) { int idx = var.getIndex(); if (type == Table.INT) { int v = row.getInt(idx); return mini <= v && v <= maxi; } else if (type == Table.LONG) { long v = row.getLong(idx); return minl <= v && v <= maxl; } else if (type == Table.FLOAT) { float v = row.getFloat(idx); return minf <= v && v <= maxf; } else if (type == Table.DOUBLE) { double v = row.getDouble(idx); return mind <= v && v <= maxd; } else { return false; } }
public boolean inside(TableRow row) { String value = row.getString(var.index); return value != null && -1 < catset.indexOf(value); }
Table data; PShape dataPlot; size(1620, 1080, P2D); //create a group to store the lines from each row dataPlot = createShape(GROUP); //load the data, specifying it has a header and it's tab separated data = loadTable("data.tsv", "header, tsv"); //traverse each row for (TableRow row : data.rows ()) { //extract each value int x1 = row.getInt("x1"); int y1 = row.getInt("y1"); int x2 = row.getInt("x2"); int y2 = row.getInt("y2"); //add the coordinates as lines to the group PShape line = createShape(LINE, x1, y1, x2, y2); float dist = dist(x1, y1, x2, y2); line.setStroke(color(map(dist, 0, height, 160, 0))); line.setStrokeWeight(map(dist, 0, height, 10.0, 1.0)); dataPlot.addChild(line); } //render the plot shape(dataPlot);
public void update(TableRow row) { int idx = var.getIndex(); if (type == Table.INT) { int value = row.getInt(idx); mini = Math.min(mini, value); maxi = Math.max(maxi, value); } else if (type == Table.LONG) { long value = row.getLong(idx); minl = Math.min(minl, value); maxl = Math.max(maxl, value); } else if (type == Table.FLOAT) { float value = row.getFloat(idx); minf = Math.min(minf, value); maxf = Math.max(maxf, value); } else if (type == Table.DOUBLE) { double value = row.getDouble(idx); mind = Math.min(mind, value); maxd = Math.max(maxd, value); } }
public boolean missing(TableRow row) { String value = row.getString(index); return value == null || value.equals(missingString); }
public boolean missing(TableRow row) { boolean miss = true; if (type == Table.INT) { int value = row.getInt(index); miss = value == MISSING_INT || specialValue(value); } else if (type == Table.LONG) { long value = row.getLong(index); miss = value == MISSING_LONG || specialValue(value); } else if (type == Table.FLOAT) { float value = row.getFloat(index); miss = value == MISSING_FLOAT || specialValue(value); } else if (type == Table.DOUBLE) { double value = row.getDouble(index); miss = value == MISSING_DOUBLE || specialValue(value); } return miss; }
public boolean missing(TableRow row) { String value = row.getString(index); return value == null || value.equals(missingString); }