[Rd] Suggestion: Making attach() and detach() generic

From: Henrik Bengtsson <hb_at_stat.berkeley.edu>
Date: Fri, 24 Aug 2007 12:07:50 -0700


Hi,

I would like to suggest to make base::attach() and base::detach() generic, in order to attach/detach fields of other containers ("databases") than the currently supported ones.

According to help on attach(), one could dispatch on (first) argument 'what'):

    what: "database". This may currently be a 'data.frame' or a 'list'

          or a R data file created with 'save' or 'NULL' or an
          environment.  See also Details.

So, in S3 terms, something like:

attach():

 attach.data.frame()
 attach.list()
 attach.environment()
 attach.character()
 attach.default()

detach() could be extended in a similar way.

The first step to make attach()/detach() generic would to justed rename the current attach() to attach.default() and ditto for detach(). [I haven't investigated all the side effects of doing this; there could be problems with substitute():s etc.]

Comments? I would be happy to do the mods, if wanted.

Cheers

Henrik



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 24 Aug 2007 - 19:35:04 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 25 Aug 2007 - 02:39:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.