[R] Error: promise already under evaluation
Joseph Lucke
j||ucke48 @end|ng |rom gm@||@com
Tue Jul 18 15:28:30 CEST 2023
A repost.
R gurus:
I have a 10 or so functions that use R’s qnbinom() function. Until now,
they have worked without any problems whatsoever.
I created a new function, which involved the integration, using R’s
integrate(), of a function that in turn uses the qnbinom() function.
The function failed because of my programming stupidity. It has been
deleted from my source file.
Now I cannot get any function using qnbinom() to work. I get the following
error.
Error in qnbinom(1 - tol, size = q, prob = r) :
promise already under evaluation: recursive default argument reference or
earlier problems?
An example function that that used to work splendidly but now fails is
#Distribution of R2: 0 to x
pRsq.Rhosq <- function(x, n, p, Rhosq,tol=tol){
a <- p /2; b <- (n-p-1)/2; q <- (n-1)/2
r <- 1-Rhosq
k <- 0:qnbinom(1-tol,size=q,prob=r)
sum(dnbinom(k,size=q,prob=r)*pbeta(x,a+k,b))
}
Tracebacks from more complicated functions, which have worked before,
always return to the above error.
When I re-source the source file without the offending function, I still
get the error.
How do I get rid of this error? What can I do to avoid it error in the
future?
TIA
Joe Lucke
[[alternative HTML version deleted]]
More information about the R-help
mailing list