From ripley at stats.ox.ac.uk  Fri Dec 23 12:22:15 2011
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Fri, 23 Dec 2011 11:22:15 +0000 (GMT)
Subject: [Rd] attach 'name' argument ignored with a file?
In-Reply-To: <4EF332F5.60504@unige.ch>
References: <4EF332F5.60504@unige.ch>
Message-ID: <alpine.LFD.2.02.1112231106360.15088@gannet.stats.ox.ac.uk>

On Thu, 22 Dec 2011, Xavier Robin wrote:

> Dear experRts,
>
> I have the feeling that the 'name' argument to the attach function is
> ignored when 'what' is a file name. Here is an example:

In current R (2.14.1) it is documented to not be used in that case 
(and it is not).

>  save(letters, file="letters.RData")
>  letters.env <- attach("letters.RData", name="letters")
>  search()
>  letters.env
>
> The name on the search path is "file:letters.RData". I would expect it
> to be "letters"...
> Tested today with R-latest.

Whatever that is.  This is not the 'at a minumum' information the 
posting guide asked you for, and it expressly asked you not to use 
inaccurate R version terminology.

> Is it by design? From the doc I read:

What 'doc', precisely, is that?   This is not what ?attach in R 2.14.1 
says.

>> name 	name to use for the attached database.
>> ...
>> The name given for the attached environment will be used by search and can be used as the argument to as.environment.
>
> I don't see why that would be restricted when 'what' is a file name.
>
> What do you think about it? Is it a bug or did I mis-read the doc?

It seems clear that there is a problem with your reading ... including 
of the posting guide, which asked you to check the current version of 
R *before posting*.  And even check future versions of R (and you 
might find that illuminating).


> Regards,
> Xavier

Did I mention the posting guide?

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] attach 'name' argument ignored with a file?
Prof Brian Ripley