Re: [R] Debugging functions defined (locally) inside another functions

2024-04-12 Thread Iago Giné Vázquez
Thank you Ivan, your example solves my issue this time through debug(environment(Adder$add)$add) Just for the future, you say 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

Re: [R] Debugging functions defined (locally) inside another functions

2024-04-12 Thread Ivan Krylov via R-help
В Fri, 12 Apr 2024 12:15:07 + Iago Giné Vázquez пишет: > 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, >

[R] Debugging functions defined (locally) inside another functions

2024-04-12 Thread Iago Giné Vázquez
Hi all, I am trying to debug an error of a function g defined and used inside another function f of a package. So I have 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

Re: [R] Debugging functions defined (locally) inside another functions

2024-04-12 Thread Iago Giné Vázquez
To be precise, in the case I am looking this time f is not a function, but f <- ggplot2::ggproto(...) So debug(f) produces Error in debug(f) : argument must be a function Iago De: R-help de part de Iago Gin� V�zquez Enviat el: divendres, 12 d�abril de 2024

Re: [R] Debugging functions defined (locally) inside another functions

2024-04-12 Thread Ivan Krylov via R-help
В Fri, 12 Apr 2024 12:53:02 + Iago Giné Vázquez пишет: > How should I call trace() if f was a function? Let the tracer be quote(debug(g)) and use as.list(body(f)) to determine where it should be injected: f <- function() { message('exists("g") so far is ', exists('g')) g <- function() {

Re: [R] Debugging functions defined (locally) inside another functions

2024-04-12 Thread Duncan Murdoch
On 12/04/2024 8:15 a.m., Iago Giné Vázquez wrote: Hi all, I am trying to debug an error of a function g defined and used inside another function f of a package. So I have f <- function(whatever){ ... g <- function(whatever2){ ... } ... } If I wanted to debug some thing

Re: [R] any and all

2024-04-12 Thread avi.e.gross
Thanks everyone and any/all reading this. I think I got my answer. And, no, I suspected I did not need to provide a very specific example, at least not yet. The answer is that my experiment was not vectorized while using dplyr verbs like mutate do their work implicitly in a vectorized way.

Re: [R] Debugging functions defined (locally) inside another functions

2024-04-12 Thread Iago Giné Vázquez
Thanks a lot both Duncan and Ivan, I will keep that example in mind, Duncan, great! Best regards, Iago De: Duncan Murdoch Enviat el: divendres, 12 d�abril de 2024 15:36 Per a: Iago Gin� V�zquez ; r-help@r-project.org Tema: Re: [R] Debugging functions defined

[R] any and all

2024-04-12 Thread avi.e.gross
Base R has generic functions called any() and all() that I am having trouble using. It works fine when I play with it in a base R context as in: > all(any(TRUE, TRUE), any(TRUE, FALSE)) [1] TRUE > all(any(TRUE, TRUE), any(FALSE, FALSE)) [1] FALSE But in a tidyverse/dplyr environment, it

Re: [R] any and all

2024-04-12 Thread Duncan Murdoch
On 12/04/2024 3:52 p.m., avi.e.gr...@gmail.com wrote: Base R has generic functions called any() and all() that I am having trouble using. It works fine when I play with it in a base R context as in: all(any(TRUE, TRUE), any(TRUE, FALSE)) [1] TRUE all(any(TRUE, TRUE), any(FALSE, FALSE))

Re: [R] any and all

2024-04-12 Thread Dénes Tóth
Hi Avi, As Duncan already mentioned, a reproducible example would be helpful to assist you better. Having said that, I think you misunderstand how `dplyr::filter` works: it performs row-wise filtering, so the filtering expression shall return a logical vector of the same length as the