Skip to content
Back to formatted view

Raw Message

Message-ID: <4FA167DA.2040600@euros4click.de>
Date: 2012-05-02T16:59:06Z
From: Heiko Neuhaus
Subject: Problems accessing environment() in function
In-Reply-To: <4FA16299.7000100@statistik.tu-dortmund.de>

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 not passed
> arguments to your test1 call.
>
> Uwe Ligges

I am aware that I am passing non existing arguments here, which is why 
my method of creating a list of the environment "as.list(environment())" 
seems to fail in this case.

What I need is a way to just skip non existing objects when I create my 
list. In my given example I was intending to receive an empty list, 
since no valid arguments were passed to test2().

In other words: I want a list containing all _existing_ variable/value 
combinations and just skip the missing ones.

Thanks again for your time

Best wishes,
Heiko Neuhaus