"foo" )) ) # works
#attach( foo.bar ) # works
}
Regards
JS
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Peter Waltman
Sent: 20 September 2007 20:24
To: Leeds, Mark (IED)
Cc: r-help@r-project.org
Subject: Re: [R] how can I attach a va
Here's a function that does what I think you want to do:
> attach.firstvar <- function(file) {
+ tmpenv <- new.env()
+ vars <- load(file, envir=tmpenv)
+ x <- get(vars[1], envir=tmpenv, inherits=FALSE)
+ if (is.list(x))
+ attach(x, name=vars[1])
+ return(vars)
+ }
> x
try:
attach(get(ls(pat="^foo")))
On 9/20/07, Peter Waltman <[EMAIL PROTECTED]> wrote:
> Hi Mark -
>
> Thanks for the reply. Sorry I didn't really clarify too well what I'm
> trying to do. The issue is not that I can't see the variable that gets
> loaded.
>
> The issue is that the variable is a
Hi Mark -
Thanks for the reply. Sorry I didn't really clarify too well what I'm
trying to do. The issue is not that I can't see the variable that gets
loaded.
The issue is that the variable is a list variable, and I'd like to write
a function that will take the .RData filename and attach th
I don't think I understand your question but John Fox has written a very
nice documentat about scoping and environments on his website.
It's probably easy to find the site by googling "John Fox" but, if you
can't find it, let me know.
As I said, I don't think that I understand your question but,
5 matches
Mail list logo