Re: [Rd] rm() deletes 'c' if c('a','b') is the argument (PR#9399)

From: <bill_at_insightful.com>
Date: Wed 29 Nov 2006 - 22:04:17 GMT


On Wed, 29 Nov 2006 p.dalgaard@biostat.ku.dk wrote:

> > A character vector c('a','b') is supplied to rm().
> > As a result, 'c' is deleted unintentionally.
> > ...
> >> a <- 1:5
> >> b <- 'abc'
> >> c <- letters
> >> ls()
> > [1] "a" "b" "c"
> >> rm(c('a','b'))
> >> ls()
> > character(0)
> ...
> I don't know if it really qualifies as a bug, but it's not documented
> that as.character() is used and I suppose we could be more careful with
> the argument checking.

I suggest that if any changes are made, then rm(c('a','b')) should throw an error.

Functions which try to be "user-friendly" by letting you omit quotes are generally a bad idea, IMO. They all need patching up in various ways to work in all situation (e.g., library's character.only=TRUE argument and the complicated code in help to see what the topic really is).

Perhaps rm() should be deprecated in favor of remove(), which uses standard S syntax rules.



Bill Dunlap
Insightful Corporation
bill at insightful dot com
360-428-8146

 "All statements in this message represent the opinions of the author and do  not necessarily reflect Insightful Corporation policy or position."



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu Nov 30 09:41:57 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 30 Nov 2006 - 03:30:56 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.