Debugging methods in R6 classes is somewhat different from debugging normal R functions.
RStudio breakpoints don’t work in R6 class methods. The simplest way to debug code is to insert a
browser() line where you want to open a debugging console, reload the classes, and then step through your code. But this involves modifying your code, reloading it, and re-instantiating any objects you want to test.
To disable debugging for future instances, use the generator’s
# Disable debugging for future instances: Simple$undebug("getx") s <- Simple$new() s$getx() #>  10
s <- Simple$new() debug(s$getx) s$getx() # [Debugging prompt]
undebug() to disable debugging on an object’s method.
undebug(s$getx) s$getx() #>  10
You can also use the
trace() function to specify where in a method you want to drop into the debugging console.