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

Xavier Robin Xavier.Robin at unige.ch
Tue Nov 22 10:55:27 CET 2011

Dear useRs & 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:

> 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"...

Is it by design? From the doc I read:

> 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? Should I fill a bug about it or did I
mis-read the doc?


More information about the R-help mailing list