Hi I need help in the recursive problem. this is my code #Generate two random Numbers minval=20 maxval=100 cutoffValue=50
optVal<- function(cutoffValue,minval,maxval) { x=runif(2) x=x*cutoffValue for( i in 1:2) { if(x[i] < 30 || x[i] >60) # checking it falls between the range { optVal(cutoffValue,minval,maxval) } } return(x) } optVal(40,20,60) I'm getting Error like this *Error: evaluation nested too deeply: infinite recursion / options(expressions=)?* Please help me to solve this error. This takes infinite loop ----- Thanks in Advance Arun -- View this message in context: http://r.789695.n4.nabble.com/error-in-Recursive-tp4281052p4281052.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list 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.