use of org.rosuda.REngine.REXPList in project rsession by yannrichet.
the class RserveSession method cat.
// <editor-fold defaultstate="collapsed" desc="Conveniency static String methods">
public static String cat(RList list) {
if (list == null || list.names == null) {
return null;
}
try {
StringBuffer sb = new StringBuffer("\t");
double[][] data = new double[list.names.size()][];
for (int i = 0; i < list.size(); i++) {
String n = list.keyAt(i);
sb.append(n + "\t");
data[i] = list.at(n).asDoubles();
}
sb.append("\n");
for (int i = 0; i < data[0].length; i++) {
sb.append((i + 1) + "\t");
for (int j = 0; j < data.length; j++) {
sb.append(data[j][i] + "\t");
}
sb.append("\n");
}
return sb.toString();
} catch (REXPMismatchException r) {
return "(Not a numeric dataframe)\n" + new REXPList(list).toDebugString();
}
}
Aggregations