How to debug s4 methode

debug an S4 methode in RStudio

I am modifying a package project in R Studio.
Here is my S4 class, which is saved in a file of my package and currently open in RStudio:

#' @exportClass
setClass(
  Class = 'some_cls', 
  slots = c(some_slot = 'numeric')
)
#' @export
setGeneric("some_method", function(self)
  standardGeneric("some_method"))

#' @exportMethod
setMethod("some_method", 
          signature(self = "some_cls"), 
          function(self) {
            self@some_slot <- 5
            self
          }
)

I tried to debug some_method as I would normally do in RStudio but when I set a breakpoint within one of the package R files, I see the warning "Breakpoints will be activated when the package is built and reloaded" and the red circle at the line I set the breakpoint is empty (which is fine I guess). Hoewever, when I click "Build and Reload" the breakpoint is removed completly (instead of being activated).
I encounter this probleme only when i try to set a breaking point in a S4 methode .. for normal functions it works without any problem.

is there a solution to this ???

I am using the latest Rstudio version 7/8/2018

1 Like

Have you solved your problem? I have the same problem as you

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.