On 13/04/2018 7:21 AM, Johannes Rauh wrote:
The function `base::rm` has an argument that is named `list`.  However, if a list is passed as `list` to `rm` 
(e.g.: `rm(list = list("x", "y"))`), an error is raised: "invalid first 
argument".

Agreed, the documentation says that `list` should be "a character vector naming 
objects to be removed."  Still, wouldn't it make sense to allow a list of characters 
as an argument?

The other alternative to make things consistent would be to rename the 
argument, but that would break compatibility, of course.

There are other functions (data(), save(), remove(), package.skeleton(), etc.) that use the convention that "list" names a character vector full of names, others where variations on that name ("affinity.list", "pkglist") have the same purpose, and still others where "list" takes a different kind of object entirely (untar(), unzip()). I couldn't find any examples where an argument named "list" takes a list as a value.

There really isn't any substitute for reading the documentation for any function you choose to use.

Duncan Murdoch

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to