Re: [R] Error: promise already under evaluation

2023-07-18 Thread Joseph Lucke
Fixed!
I was not passing a tol value from the outer function to the inner
qnbinom() function. Because the scope of tol in qbinom() was confined to
the outer function, qnbinom was not accessing the globally defined tol
value. Furthermore, because the outer function itself was embedded in
integrate(), the standard nonstandard scoping didn't enable access to the
global value.
I hope this makes sense.
In any case, the problem has been solved.
Thanks.

On Tue, Jul 18, 2023, 10:38 AM Ivan Krylov  wrote:

> В Tue, 18 Jul 2023 09:28:30 -0400
> Joseph Lucke  пишет:
>
> > Error in qnbinom(1 - tol, size = q, prob = r) :
>
> > pRsq.Rhosq <- function(x, n, p, Rhosq,tol=tol){
>
> It looks like you're not passing the `tol` parameter, and its default
> value unfortunately refers to itself:
>
> (function(x = x) x)()
> # Error in (function(x = x) x)() :
> #   promise already under evaluation: recursive default argument
> #   reference or earlier problems?
>
> --
> Best regards,
> Ivan
>

[[alternative HTML version deleted]]

__
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.


Re: [R] Error: promise already under evaluation

2023-07-18 Thread Ivan Krylov
В Tue, 18 Jul 2023 09:28:30 -0400
Joseph Lucke  пишет:

> Error in qnbinom(1 - tol, size = q, prob = r) :

> pRsq.Rhosq <- function(x, n, p, Rhosq,tol=tol){

It looks like you're not passing the `tol` parameter, and its default
value unfortunately refers to itself:

(function(x = x) x)()
# Error in (function(x = x) x)() :
#   promise already under evaluation: recursive default argument
#   reference or earlier problems?

-- 
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.