From istazahn at gmail.com  Sat Apr 14 01:04:36 2018
From: istazahn at gmail.com (Ista Zahn)
Date: Fri, 13 Apr 2018 19:04:36 -0400
Subject: [Rd] In base R: argument `list` does not accept lists
In-Reply-To: <71f5532a-3a2e-b9f1-d23f-b407f3bd9d8b@gmail.com>
References: <24e3bce3ef024b3ca921f7c8319b37a6@C119S212VM016.msvyvi.vaha.local>
 <trinity-3b077c08-3449-471d-8752-8c56b47800b1-1523618487386@3c-app-webde-bs06>
 <71f5532a-3a2e-b9f1-d23f-b407f3bd9d8b@gmail.com>
Message-ID: <CA+vqiLEF4_=agViJrHHPjjFwjjHR7uODJShq985-JDRr8zP3ag@mail.gmail.com>

On Fri, Apr 13, 2018 at 3:51 PM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
> 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.

Maybe, though if so it's at least a little ironic that you make an
appeal to consistency in support of the status quo. "Read the docs"
you say, because if you do you'll see that "list" never means list,
and then you won't have to read the docs because you have learned the
convention. Maybe.

On the other hand, the OP wasn't so much reporting a bug as making a
feature request. Really, why shouldn't the "list" argument of rm,
data, save, remove, etc. accept either a list of a vector? I can't
think of anything it would hurt, and it would help people who assume
(reasonably enough IMO) that an argument named "list" will accept a
list as as a valid value?

Best,
Ista

>
> Duncan Murdoch
>
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] In base R: argument `list` does not accept lists
Ista Zahn