Skip to content
Prev 14232 / 398506 Next

recursive functions and global variables

On Sun, 14 Oct 2001, David A Richmond wrote:

            
You probably want to use a named environment. There's an example in the
`Programmer's Niche' section of the 2nd R newsletter, on the R home page.

Basically, you create an environment like

   storage<-new.env()

and pass it down through your functions. You can then use get() and
assign() to retrieve and modify objects in this environment.

This is often the R way to handle issues for which S-PLUS programmers
would use 'frame 0' and 'frame 1'.


	-thomas

Thomas Lumley			Asst. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._