- type of projects that RCaller used in
- frequently used functions of R
- new functionality required.
- Bug reports
We need developers, testers, documenters which may have skills on Java, R, LaTeX or HTML.
We can enlarge the space spanned by RCaller, say that, PhpCaller, CCaller or something derivative may be included for Php and C, respectively. Note that, there are already some libraries for calling R from other languages. RCaller has lesser efficiency on run time but higher speed on development time.
Please join the project.
google code page: https://code.google.com/p/rcaller/
Yeah, RCaller is kinda slow at run time...
ReplyDeleteAlso, it would be nice to have something that helps calling custom R function without using the addRCode() method. A RCaller function that takes (function_name, arguments) as parameters or even better a code generator that reads the R code and returns a Java method signature with the needed arguments type.
If I'm missing anything regarding calling custom Rfunctions please let me know..
i am totally focused on renjin but i will consider your idea when i get more time.
ReplyDeletethank you!
You're welcome.
ReplyDeleteRight now this is how I'm doing it (I'm not very familiar with R):
1)RCaller rCaller = new RCaller(); 2)rCaller.setRscriptExecutable(RSCRIPT_EXEC);
3)rCaller.cleanRCode();
4)rCaller.addRCode("source('" + R_SCRIPT + "')");
5)rCaller.addRCode("result <- func_name(" + args + ")");
6)rCaller.runAndReturnResult("result");
R_SCRIPT is the full path of the file.r containing the custom R function func_name. Of course calling the function again with different arguments is not really easy. If there is a better way, please let me know.
Also, do you think that line 4 might be playing a big role in the execution time of line 6?
Thanks!
Note that RCaller has two methods for adding an external package or a source program:
ReplyDeletepublic void R_require(String pkg)
public void R_source(String sourceFile);
so you can write
rCaller.R_source(R_SCRIPT);
instead. Ofcourse it is only a "bit" of a gigabyte but it makes the code more readable.
The whole in-efficiency underlying the logic of RCaller is creating external RScript processes. Your code does nothing by means of execution time.
I plan to do something different in next revision.
My plan is to create Rscript once, send R commands with streams and receive the results as external XML files. These changes will increase the speed by 5-10 times. ofCource It is only a prediction. but seems right.
Back to your code.
it seems perfect :)
Thanks! R_source does feel better than how I was doing it!
ReplyDeleteI was thinking of establishing a single external RScript connection and passing several inputs all at once in an array/list. The R script would then be modified to loop through them, generate results and return them as an array. Do you think that this would speed up the process considerably?
Thanks!
Your desired method will exactly speed up the process. It is a neat idea!
ReplyDeleteLook at the post abour handling list with rcaller 2 on this blog. That is what you need at all.
Thank you for your great and detailed interest on rcaller.
I had fun by doint it, so hope you will!
Thanks!
I think the latest release may speed up your process.
ReplyDeleteCheck the page:
http://stdioe.blogspot.com/2011/09/rcaller-support-for-sequential-commands.html
I implemented the first solution and it worked great:
ReplyDeleterCaller.addRCode("results <- list()");
for(...) {
rCaller.addRCode("results[[\""+key+"\"]] <- my_func("+args+")");
}
rCaller.runAndReturnResult("results");
//my_func returns a double array
double[] rs = rCaller.getParser().getAsDoubleArray(key);
Thanks!
P.S. Version 2.1 seems to hang indefinitely in Netbeans (the process never ends).
very good!
ReplyDeletecan you send me the code which cause to hang up?
if I re-produce the error, I can fix it.
I just copied/pasted your code sample from your latest post "support for sequential commands" and I noticed this issue. I'm using Netbeanas 7.0.1 with Java 1.6.0_25 on a 64bit Windows 7 Professional machine.
ReplyDeleteToday I run the test suite in a Windows platform and it was succeed. If you still need RCaller (because it seems you solved your problem) have a look at the source code and browse the test.
ReplyDeletebest.
We are happy to announce that we started two parallel projects
ReplyDeletefor rcaller. They are the php and the perl editions of rcaller
which are intented to be compatible with the original version.
We are also planning to develop a python edition sooner. Any other
platform is welcome. Help needed. If you write codes with .net, python, php and familier with r , join us and start coding with rcaller.