Package |
base R |
base R |
S7 |
R6 |
Programming type |
Functional |
Functional |
Functional |
Encapulated |
Complexity |
Low |
High |
Medium |
High |
Payoff |
Low |
High |
High |
High |
Team size |
Small |
Small-large |
Large |
? |
Namespace |
Global |
Global? |
Global? |
Local |
Modify in place |
No |
No |
No |
Yes |
Method chaining |
|> |
|> ? |
|> ? |
$ |
Get/set component |
$ |
@ |
@ |
$ |
Create class |
class() or structure() with class argument |
setClass() |
new_class() |
R6Class() |
Create validator |
function() |
setValidity() or validator argument in setClass() |
validator argument in new_class() |
$validate() |
Create generic |
UseMethod() |
setGeneric() |
new_generic() |
NA |
Create method |
function() assigned to generic.method |
setMethod() |
method() |
R6Class() |
Create object |
class() or structure() with class argument or constructor function |
new() |
Use registered method function |
$new() |
Additional components |
attributes |
slots |
properties |
|
|
|
|
|
|