I'm not an expert on R6, but since every R6 class is an environment, you can add whatever you want to this environment.
how
MyClass$my_static_method <- function(x) { x + 2} MyClass$my_static_method(1)
But the method does not work on the class instance :
instance1 <- MyClass$new() instance1$my_static_method(1)
You must be careful with existing objects in the class environment. To see what is already defined, use ls(MyClass)
bergant
source share