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?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.