Re: [R] Dummy quesion about environment

From: venomousanimal <venomousanimal_at_web.de>
Date: Wed 28 Sep 2005 - 06:55:41 EST

Hej,

but in your function you add x and y to 10 and 3, so your values are merged to one value available in g variable. And now you want to see what was your y and your x? I guess I do not get the idea of your question. Well, then you could return y and x as well as g.

Greetz n god luck.

Roger D. Peng schrieb:

>Try 'get("x", env = environment(h))'
>
>-roger
>
>Ron Ophir wrote:
>
>
>>Hi,
>>I'm trying to understand environment object in R.
>>I used the example:
>> f <- function(x) {
>> y <- 10
>> g <- function(x) x + y
>> return(g)
>> }
>> h <- f()
>> h(3)
>>then i saw that f return an environment
>>
>>
>>
>>>h
>>>
>>>
>>function(x) x + y
>><environment: 01B28570>
>>but I coudn't access to x and y object in that environment:

>>I tried
>>get("x",env=h)
>>I tried
>>h$y
>>can I access y and x?
>>how can I see an environment tree? oes search does it?

>>Thanks,
>>Ron
>>
>>______________________________________________
>>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 Wed Sep 28 07:02:22 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 17:50:25 EST