Skip to content

Commit

Permalink
FIXED: Bug #457 - OpenInR sometimes fails to transfer the table to R
Browse files Browse the repository at this point in the history
(size parameter to read the binary Rdata was too small in some cases. file size now retrieved by R command instead of using the function 'estimateNumValues')
  • Loading branch information
niederle committed May 5, 2011
1 parent 76d6e61 commit b3b6567
Showing 1 changed file with 6 additions and 5 deletions.
Expand Up @@ -70,7 +70,7 @@ protected BufferedDataTable[] execute(final BufferedDataTable[] inData,
workspaceFile = File.createTempFile("rplugin", ".RData");
workspaceFile.deleteOnExit();

REXP xp = connection.parseAndEval("r=readBin(tmpwfile,'raw'," + estimateNumValues(inData) + "); unlink(tmpwfile); r");
REXP xp = connection.parseAndEval("r=readBin(tmpwfile,'raw',file.info(tmpwfile)$size); unlink(tmpwfile); r");
FileOutputStream oo = new FileOutputStream(workspaceFile);
oo.write(xp.asBytes());
oo.close();
Expand Down Expand Up @@ -119,8 +119,9 @@ public static void openWSFileInR(File workspaceFile, String script) throws IOExc

/**
* Attempts to find an upper bound of the number of values of node input.
* USAGE IN 'execute' method HAS BEEN REPLACED BY AN R-COMMAND - CAN BE DELETED AT SOME POINT
*/
private int estimateNumValues(BufferedDataTable[] pushTable) {
/* private int estimateNumValues(BufferedDataTable[] pushTable) {
int inputSize = 0;
Expand All @@ -133,10 +134,10 @@ private int estimateNumValues(BufferedDataTable[] pushTable) {
return (int) (10.1 * inputSize); // add some size for meta data like table headers
}
} */


private int calcTableSize(BufferedDataTable bufferedDataTable) {
/* private int calcTableSize(BufferedDataTable bufferedDataTable) {
return bufferedDataTable.getDataTableSpec().getNumColumns() * bufferedDataTable.getRowCount();
}
} */
}

0 comments on commit b3b6567

Please sign in to comment.