Skip to content
Prev 55035 / 63421 Next

In base R: argument `list` does not accept lists

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.

Best
Johannes