The goal of sloop is to provide tools to help you interactively explore and understand object oriented programming in R, particularly with S3.

Please note that unlike other r-lib packages, sloop only works with R 3.3 and later.

Installation

You can install sloop from github with:

Usage

library(sloop)

sloop provides a variety of tools for understanding how S3 works. The most useful is probably s3_dispatch(). Given a function call, it shows the set of methods that are considered, found, and actually called:

To the best of my ability it covers all the details of S3 method dispatch including group generics, internal generics, implicit classes, and use of NextMethod() (indicated by ->):

It also provides tools for determing what type of function or object you’re dealing with:

And for retrieving the methods associated with a generic or class: