[R] truly object oriented programming in R
joehl at gmx.de
Fri Aug 13 10:45:09 CEST 2004
Of course you can do almost eveything in R, but I have rarely seen someone
prototyping something in Java to then implement it in R. KD-trees are for
performance, and interpreted R is not really fast. So interfacing some
foreign code might really be the better choice here.
Since you have already Java code, the most straightforward choice might seem
interfacing the Java code via SJava or RJava. However, though there are
packages RJava and SJava, it looks like there is no recommended Java
interface which is maintained across all relevant platforms, and thus
nothing at CRAN. Given the richness of available Java software, this is a
pitty, but a reality. I am currently trying to remove remaining memory leaks
from SJava 0.66 for Windows, but this is a one time effort, not a
Get some standard KD-tree C-code and modify it to your needs. Then interface
it using the C- or Call-interface, to write an access function for every
operation you want to perform on the KD-tree from R.
Write your own C-code operating directly on R-data structures. In this case
you do not only interface a KD-tree, you really have it in R but you can
have the most important operations coded in C. But this is the technically
most challenging one. You need to to know C, read "Writing R Extensions"
very carefully, you need to understand the sets of macros defined in
Rdefines.h and Rinternals.h, especially you need to understand all the
PROTECT macros and how to avoid overloading the protect-stack, because you
will need to reprotect your KD-tree very often.
Hope that helps
NEU: WLAN-Router für 0,- EUR* - auch für DSL-Wechsler!
GMX DSL = supergünstig & kabellos http://www.gmx.net/de/go/dsl
More information about the R-help