Hi,

I am now using R to implement a stepwise algrithom which includes a
recursion function.
e.g:
--------------------------------
a = 1
*f_recursion* = function(id)
{
      b = a + id;   #: row A
      if (...){ a = a +1;* f_recursion*(b) }  #: row B
      else{ .... }
}
----------------------------------
I find that if the code '*f_recursion*(b)' in row B is invoked, that means
 'a' equals to 2 now. But in the procedure of '*f_recursion*(b)', the 'a'
still equals the initial value 1.

I don't know why, maybe it is a bug for R. Dose R support recursion
function?


Look forward to your reply, thanks a lot!

-- 
All the best,
Xiuquan Wang

        [[alternative HTML version deleted]]

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

Reply via email to