Skip to content
Back to formatted view

Raw Message

Message-ID: <1317788874982-3873380.post@n4.nabble.com>
Date: 2011-10-05T04:27:54Z
From: Andrew Hoerner
Subject: reporting multiple objects out of a function

Dear folks, 

I?m trying to build a function to create and make available some variables I
frequently use for testing purposes.  Suppose I have a function that takes
some inputs and creates (internally) several named objects. Say, 

fun1 <- function(x, y, z) {obj1 <- x; obj2 <- y; obj3 <- z
<missing stuff>
}

Here is the challenge: After I run it, I want the objects to be available in
the calling environment, but not necessarily in the global environment.  I
want them to be individually available, not as part of a list or some larger
object.  I can not figure out how to do this.  If I understand the situation
correctly, I am trying to move several separate objects from the environment
of the function to the environment in which the function was invoked (the
?calling environment,? yes?).  

I?m pretty sure there is a command to do this, but I?m not sure how to find
it. Any help would be greatly appreciated ? either on the necessary code, or
on how to search for it, or a reference to a good discussion of this family
of problems.

Sincerely, andrewH


--
View this message in context: http://r.789695.n4.nabble.com/reporting-multiple-objects-out-of-a-function-tp3873380p3873380.html
Sent from the R help mailing list archive at Nabble.com.