David Smith explains what R6 classes are in R:
The big advantage of R6 is that it makes it much easier to implement some common data structures in a user-friendly manner. For example, to implement a stack “pop” operation in S3 or S4 you have to do something like this:x <- topval(mystack) mystack <- remove_top(mystack)
In R6, the implementation is much simpler to use:x <- mystack$pop()
David links to some good resources on the topic, so check those out as well.