When does it pay off to use S4 methods in R programming

前端 未结 7 1313
不知归路
不知归路 2020-12-12 13:55

I program regularly in R in a professional context, and I write packages for clients or co-workers as well. Some of the programmers here have a Java background and insist on

7条回答
  •  庸人自扰
    2020-12-12 14:18

    Don't forget there's also R.oo (on CRAN) which provides a third way of doing OO in R. In my mind this provides an OO system that might be more familiar to programmers migrating from other systems - in particular instead of having generic functions (so that print(foo) then has to dispatch on the class of foo) the methods are tied to the object, so you'd do foo$print() - just as in python or C++ you'd do foo.print().

提交回复
热议问题