Friday, January 24, 2014

Mimicking Object-Oriented Behavior with R Functions (that is Closures)

Actually, there is already a number of ways and packages object-oriented semantics implemented in R. It is nicely summarize in the Table 1 of this article. Let's assume for a moment this diversity of object-oriented approaches in R is not enough. There is an unbearable urge to implement yet another one. Well... let's exploit the fact that functions in R are not functions in a C++ or even Python sense. They are closures. Put in a simple terms it is a function that packaged up with some state. That state (environment in case of R) may contain variables and functions. A couple of other posts on a somewhat relevant topic that I may suggest are here and here.

Checking font availability on Mac   fc-list : family | grep "Fira Code"   or   system_profiler -json SPFontsDataType | grep \...