You can add a show
method to your reference class as detailed in ?setRefClass
. As an example
MyClass <- setRefClass("MyClass" , fields = list(data="numeric"))
MyClass$methods(show = function(){print("This is printed representation: ")
print(data)})
OBJ <- MyClass(data=1:4)
> OBJ
[1] "This is printed representation: "
[1] 1 2 3 4