Programmers learn & share
0 votes
63 views

Problem :

My R code is giving me following error
promise already under evaluation: recursive default argument reference or earlier problems?
by (6.9k points)   | 63 views

1 Answer

0 votes

Solution :

Formal arguments of the form x=x are causing this issue. So eliminating them we get the updated and working code as follows:

f <- function(x, T) {
   10 * sin(0.3 * x) * sin(1.3 * x^2) + 0.001 * x^3 + 0.2 * x + 80 
}

g <- function(x, T, f. = f) {## 1.just note f.
   exp(-f.(x)/T) 
}

test<- function(g. = g, T = 1) {## 2.just note g.
   g.(1,T) 
}

by (36.1k points)  
2,245 questions
2,807 answers
60 comments
241 users