Ah, good point :-) You can avoid that by using inheritance, but now you're
on a route to refactoring your entire package actually. See also this
question on stackoverflow for a nice example of how this can be done:
https://stackoverflow.com/questions/26963900/generalizing-three-dots-argument-disp
Hi Charles,
that particular construct (with the dots) I only have in proprietary
packages, so I can't share the code for those. If you have the package on a
repo on github, you can give me a link and a pointer as to what file you're
working on, and I can take a look.
You also find some nice examp
Ah, I see now. I came across this previous post (
http://r.789695.n4.nabble.com/override-pmin-pmax-for-my-own-matrix-td4715903.html)
which mentioned the caveat that all the elements passed to ... must be the
same. When I pass two of the same class it works but I believe I will need
to go back to
Could you point to one of these packages you refer to? I'm still having
problems and not sure why at the moment.
Thanks
On Mon, Jun 26, 2017 at 12:32 PM, Joris Meys wrote:
> Hi Charles,
>
> my mistake. I forgot that pmax has an extra argument na.rm. I'm surprised
> you could define the method,
Hi Charles,
my mistake. I forgot that pmax has an extra argument na.rm. I'm surprised
you could define the method, as this normally should return an error from
conformMethod().
So:
#' @rdname pmax
setGeneric("pmax", signature = "...")
should work. I've used this myself in quite a number of packa
Thanks for the reply Joris, although I am not sure what I could be doing
wrong. I implement exactly the lines you show and yet I just get the
following error when I call 'pmax' on the class.
> pmax(x, 0)
Error in mmm < each :
comparison (3) is possible only for atomic and list types
In additio
Hi Charles,
if a generic exists already in the base, you only have to export the actual
S3 method. Your problem is that base::pmax() is not a generic S3 function.
So R gives you the correct warning: the S3 generic in your package will
always mask the base pmax function. And that's not really a pro