should I use setRefClass() ?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

should I use setRefClass() ?

Ben Nachtrieb

I am somewhat new to R programming and a novice C++ programmer.

I'd like to know if I should use setRefClass() to manage objects, functions,
and data in a very large program I am attempting to code.

I like the referential class structure that C++ provides and R seems to
provides via setRefClass(). Mainly what I like is that I can code custom
member functions that 'do stuff' inside a class.

I understand that setRefClass() kind of gets away from the way R was
intended to be used. It is this 'understanding' that makes me worry about
using something setRefClass(). The program that I am attempting to build is
very big, complex (for me), and it needs to be efficient (from a code
readability standpoint and from a speed standpoint). I will be using a lot
of the built-in R stats-centric functions. Are there any pitfalls I should
be aware of? Any insight or suggestions? I was thinking the setRefClass()
function would provide what I like in C++, but allow me to do everything in
R (rather than having C++ and R interface with each other).

Thanks for any help!


        [[alternative HTML version deleted]]

[hidden email] mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.