Re: [R] Dummy quesion about environment

2005-09-28 Thread Ron Ophir
Thank you Peter, for the comprehensive explanation. The reason I asked Does 'search do it?' is that as I can run ls(env=environment(h)) I can run ls(env=environment(package:methods)) or ls(package:methods) which I can see by search. I thought maybe what I see by search is all the environments

Re: [R] Dummy quesion about environment

2005-09-27 Thread Roger D. Peng
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

Re: [R] Dummy quesion about environment

2005-09-27 Thread Peter Dalgaard
Ron Ophir [EMAIL PROTECTED] writes: 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 +

Re: [R] Dummy quesion about environment

2005-09-27 Thread venomousanimal
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