I see the logic, but it seems in practice people often write specific
methods with their own specific arguments. (Think of the many plot or print
methods for different objects, for example.) Here, enforcing a ... argument
does not buy us much. All that we really need is that plot(x) will work for
m
Hi Jeffry,
Going back to your original problem with README.md: as far as I can see, it
seems that the warning message is triggered by running pandoc on README.md; see
for example these lines:
https://github.com/wch/r-source/blob/6705a31c7fadc646180e1b62a70fc85f447e4d55/src/library/tools/R/chec
When writing README.md, keep in mind that it may (and will!) appear and be
rendered at many places, not only CRAN and Github. METACRAN is a prime example
with always up-to-date information but there are a number of others. So links
need to be written with that in mind.
Also, some sites providi
... also, the only reason non-generic functions using ellipsis can throw an
error when an argument is not used is that they keep passing ... on to
functions that recursively encounter fumctions that eventually do not accept an
ellipsis argument. If the function calls a generic with an ellipsis a
R encourages the use of ... particularly in S3 generics, to avoid
over-depending on inheritance to enable flexible use of these generics. That
is, when you call the generic without knowing which class you are giving it,
you cannot specify class-specific arguments. However, some methods have obvi
Hi Jeff,
I wouldn't say R encourages that in general. Non-generic functions will
throw an error if you use a non-existent argument. And some generic
functions check for it:
seq(1, 3, blah = 1)
[1] 1 2 3
Warning message:
In seq.default(1, 3, blah = 1) :
extra argument ‘blah’ will be disregarded
You seem to think this is a bad thing. R does encourage lenient argument
checking... what rock have you been under for the last 20 years?
On March 8, 2020 5:41:51 AM PDT, David Hugh-Jones
wrote:
>You're quite right :-) But I think the polemic still holds, because I
>have
>to add manual argument
You're quite right :-) But I think the polemic still holds, because I have
to add manual argument checking to all my methods, which has a cost in
lines of code. Indeed, few base R methods have chosen to do this. In
effect, the current setup encourages writing methods with "lenient"
argument specifi
As well as having a vignette one thing which encourages me to
investigate a package is having NEWS. You may already have this of course.
Michael
On 07/03/2020 23:05, Jeffry Hesse wrote:
Good to know!
Right now we are using the README.rmd file to create the README.md, I
imagine we'd create som
You can add the ... argument to chop.default(), and then check that
length(list(...)) is zero.
Also, you might be interested in the ellipsis package.
Gabor
On Sun, Mar 8, 2020 at 10:56 AM David Hugh-Jones
wrote:
>
> Hi all,
>
> My package defines the following method and generic:
>
> chop <- fu
Hi all,
My package defines the following method and generic:
chop <- function (x, ...) UseMethod("chop")
chop.default <- function (x, breaks, labels, extend = NULL, drop = TRUE) {
... }
R CMD check then gives a warning:
W checking S3 generic/method consistency (695ms)
chop:
function(x
11 matches
Mail list logo