[18836] in s-news-athena
[S] Passing object names to attach, detach (oops)
daemon@ATHENA.MIT.EDU (Michael Prager)
Tue Aug 3 14:16:00 1999
Message-Id: <4.2.0.58.19990803140504.00a366f0@mail.bea.nmfs.gov>
Date: Tue, 03 Aug 1999 14:11:29 -0400
To: s-news@wubios.wustl.edu
From: Michael Prager <Mike.Prager@noaa.gov>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; format=flowed
List readers,
I posted the following in error. The example was working fine, but I
failed to realize it, because search() returns the dummy argument name
rather than the actual argument. I regret the distraction.
...MHP
-------------------------
Is it possible to pass data frame names through function calls to
"attach()" and "detach()"? How?
The following simple example does not work:
hookup <- function(x)
{attach(x)}
hookup(test2.a)
In this case, a nonexistent directory "x" seems to get attached, rather
than the data frame passed by name. If there IS some approach that works
with "attach()", would the same approach work with "detach()"? I note that
apparently "detach()" requires data frame names be quoted and "attach()"
requires that they NOT be quoted.
More generally, is it possible to pass symbolic string values to functions
and later cause them to be considered names of variables, names of data
frames, parts of names of data frames (to be manipulated with "paste()"),
or names of ASCII files to be read?
To clarify the need for those who are also SAS users: If I were using SAS
to do this work, I'd use the symbolic variable component of the macro
facility -- defining character strings with "%LET" and causing them to be
evaluated with "&".
Thanks!
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news