I have been implementing binary tree search algorithm recently in R, and before that I used linked array-like structures. These algorithm would be much easier if there were pointers in R (not C pointers, but references to objects). I wonder if there is a workaround. I don’t know S4 at all; maybe it is possible in that framework? I would avoid environment-related tricks, since that pass-by-reference is a little too bit of a workaround. And I would avoid invocations of C or C++’s STL. It’s an R question after all.
I have been implementing binary tree search algorithm recently in R, and before that
Share
R 2.12 will start to bring you some of this. In the meantime, the common recommendation is to use environments to approximate call-by-reference.