Re: [R] Putting an object in to a function that calls the current function

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Thu 05 Jan 2006 - 01:21:45 EST

Check out:

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/64929.html

On 1/4/06, Ales Ziberna <aleszib@gmail.com> wrote:
> Hello!
>
> I would like to put an object in to a function that calls the current
> function.
>
> I thought the answer will be clear to me after reading the help files:
> ?assign
> ?sys.parent
>
> However it is not.
> Here is an example I thought should work, however it dose not exactly:
>
> f<-function(){s();print(a)}
> s<-function()assign(x="a",value="ok",pos=sys.parent())
> f() #I want to get "ok"
> a #I do not want "a" in global enviorment, so here I should get
> #Error: Object "a" not found
> ff<-function()f() #here I also want to get "ok" - it should not matter if
> the parent fuction has any parents
>
> Thank you in advance for suggestions!
>
> Ales Ziberna

>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jan 05 01:36:31 2006

This archive was generated by hypermail 2.1.8 : Thu 05 Jan 2006 - 05:28:40 EST