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

2018-04-13 Thread Johannes Rauh
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

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


[Rd] Fwd: suggested patch for messages

2018-04-13 Thread Ben Bolker
Any follow-up/comments on this? If I don't hear back I'll submit to
r-bugs so it doesn't get lost ...

(Don't see any changes in QC.R in the last few days ...
https://github.com/wch/r-source/commits/trunk/src/library/tools/R/QC.R
)

-- Forwarded message --
From: Ben Bolker 
Date: Sun, Apr 8, 2018 at 1:45 PM
Subject: suggested patch for messages
To: r-devel@r-project.org


Does anyone have comments on the new wording here?

Suggested:

The Title field should be in title case. Current version is:
   (xxx)
In title case this would be:
   (Xxx)

Hoping R core will see this here and magically adopt it, otherwise
I'll try posting it to the r bugs site ...

===
--- src/library/tools/R/QC.R(revision 74551)
+++ src/library/tools/R/QC.R(working copy)
@@ -7727,8 +7727,10 @@
 "The Title field starts with the package name."
 },
 if(length(y <- x$title_case)) {
-paste(c("The Title field should be in title case,
current version then in title case:",
-sQuote(y)),
+paste(c("The Title field should be in title case.
Current version is:",
+sQuote(y[1]),
+"In title case this would be:",
+sQuote(y[2])),
   collapse = "\n")
 })),
   fmt(c(if(length(x$descr_bad_initial)) {

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


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

2018-04-13 Thread Duncan Murdoch

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


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

2018-04-13 Thread Ista Zahn
On Fri, Apr 13, 2018 at 3:51 PM, Duncan Murdoch
 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@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

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