Reputation: 7730
Here is my S4 class, which is saved in separate file and currently open in RStudio:
setClass(
Class = 'some_cls',
slots = c(some_slot = 'numeric'),
)
setGeneric("some_method", function(self)
standardGeneric("some_method"))
setMethod("some_method",
signature(self = "some_cls"),
function(self) {
self@some_slot <- 5
self
}
)
In another file I execute:
some_obj <- new('some_cls')
some_obj <- some_method(some_obj)
I tried to debug some_method
as I would normally do in RStudio. I put dot next to line self@some_slot <- 5
, in I RStudio I clicked Source
in top right corner, but code execution did not stop at breakpoint. What am I doing wrong?
Upvotes: 4
Views: 433
Reputation: 44788
This looks like a bug in RStudio; you might want to report it to them. The underlying infrastructure in R has no problem handling a situation like yours.
For example, if the first file is called test.R
, and you want the breakpoint on line 12, just run
setBreakpoint("test.R#12")
and execution will break when you get there.
Upvotes: 3