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

Xavier Robin Xavier.Robin at unige.ch
Thu Dec 22 14:39:01 CET 2011


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:

  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.

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

Regards,
Xavier



More information about the R-devel mailing list