[R] To implement OO or not in R package, and if so, how to structure it?
ashenkin at ufl.edu
Thu Sep 14 14:58:51 CEST 2017
I am trying to decide how to structure an R package. Specifically, do I
use OO classes, or just provide functions? If the former, how should I
structure the objects in relation to the type of data the package is
intended to manage?
I have searched for, but haven't found, resources that guide one in the
*decision* about whether to implement OO frameworks or not in one's R
package. I suspect I should, but the utility of the package would be
aided by *collections* of objects. R, however, doesn't seem to
Background: I am writing an R package that will provide a framework for
analyzing structural models of trees (as in trees made of wood, not
statistical trees). These models are generated from laser scanning
instruments and model fitting algorithms, and hence may have aspects
that are data-heavy. Furthermore, coputing metrics based on these
structures can be computationally heavy. Finally, as a result, each
tree has a number of metrics associated with it (which may be expensive
to calculate), along with the underlying data of that tree. It will be
important as well to perform calculations across many of these trees, as
one would do in a dataframe.
This last point is important: if one organizes data across potentially
thousands of objects, how easy or hard is it to massage properties of
those objects into a dataframe for analysis?
Thank you in advance for thoughts and pointers.
More information about the R-help