Re: [R] Problems accessing environment() in function

2012-05-02 Thread Uwe Ligges
On 01.05.2012 19:57, Heiko Neuhaus wrote: Hi all, I am trying to create a list of all variable/value combinations in environment(). When a function with unset arguments is called, the method I have been using fails with a missing argument error. However it should be possible to simply skip

Re: [R] Problems accessing environment() in function

2012-05-02 Thread Heiko Neuhaus
Thanks a lot for your answer! -- test1 - function(a, b, c) { x - as.list(environment()) print (hi from test1!) test2(a = a, b = b, c = c) You are rying to pass a, b, c here and hence R tries to insert those into the environment of test2 once it is called, you have

Re: [R] Problems accessing environment() in function

2012-05-02 Thread Duncan Murdoch
On 02/05/2012 12:59 PM, Heiko Neuhaus wrote: Thanks a lot for your answer! -- test1- function(a, b, c) { x- as.list(environment()) print (hi from test1!) test2(a = a, b = b, c = c) You are rying to pass a, b, c here and hence R tries to insert those

Re: [R] Problems accessing environment() in function

2012-05-02 Thread Heiko Neuhaus
Thank you very much for your suggestion. f - function(a,b,c) { names - ls(environment()) # get all the names result - list() for (n in names) { if (!do.call(missing, list(as.name(n result[n] - get(n) } result } I have already figured out a very similar solution using for/eval that

Re: [R] Problems accessing environment() in function

2012-05-02 Thread Duncan Murdoch
On 12-05-02 5:20 PM, Heiko Neuhaus wrote: Thank you very much for your suggestion. f- function(a,b,c) { names- ls(environment()) # get all the names result- list() for (n in names) { if (!do.call(missing, list(as.name(n result[n]- get(n) } result } I have already figured out a very

[R] Problems accessing environment() in function

2012-05-01 Thread Heiko Neuhaus
Hi all, I am trying to create a list of all variable/value combinations in environment(). When a function with unset arguments is called, the method I have been using fails with a missing argument error. However it should be possible to simply skip these missing objects in the generation of