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

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Dec 23 12:22:15 CET 2011


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



More information about the R-devel mailing list