[Rd] Exchange of information between functions aside from argument/return-value interface

Peter Ruckdeschel Peter.Ruckdeschel at uni-bayreuth.de
Wed Apr 4 20:27:21 CEST 2007


Thank you, Luke, for your promptous response.

[snipped away my original message; to be found on
 https://stat.ethz.ch/pipermail/r-devel/2007-April/045216.html]

> Sounds like lexical scoping should work for this also -- use <<- to
> assign to the variable in the containing scope.
> 
> Best,
> 
> luke

yes, in my application, this really solves the problem. Thank you.


But I am not quite sure for the general situation:

Recall that we have the sequence of calls

myF() calls notmyG() which --with possibly more functions involved in between--
directly or indirectly calls myH().

Now, if I do not know exactly which variables are defined
in the intermediate notmyG() or in some of the functions called "in between",
I would have thought that using

VariableInMyF <<- something

within myH() bears the danger that I am overwriting
a variable of name VariableInMyF in notmyG() and "in-between's"
instead of in myF().

Or did I get something wrong?

Thanks for your help
Peter



More information about the R-devel mailing list