[Rd] Suggestion: Making attach() and detach() generic
Henrik Bengtsson
hb at stat.berkeley.edu
Fri Aug 24 21:07:50 CEST 2007
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
More information about the R-devel
mailing list