В Fri, 12 Apr 2024 12:15:07 +0000 Iago Giné Vázquez <iago.g...@sjd.es> пишет:
> f <- function(whatever){ > ... > g <- function(whatever2){ > ... > } > ... > } > > If I wanted to debug some thing directly inside f I would do > debug(f). But this does not go inside g code. On the other hand, > debug(g) does not work as g is not a defined function in the > namespace of the package. Moreover, `g` doesn't exist at all until f() is evaluated and reaches this point. If `f` was a function, it would be possible to trace() it, inserting a call to debug(g) after it's created. > f <- ggplot2::ggproto(...) > > So debug(f) produces > Error in debug(f) : argument must be a function Can you show more information about the call that produces `f`? Where does `g` come into play? Following ?ggplot2::ggproto, I can trigger the browser if I reach into the environment of the publicly available method: Adder <- ggproto(...) # from the example debug(environment(Adder$add)$add) Adder$add(1234) # debugging in: add(..., self = self) # debug на #3: { # self$x <- self$x + n # self$x # } -- Best regards, Ivan ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.