Re: [Rd] Odd behaviour in within.list() when deleting 2+ variables

2017-06-26 Thread peter dalgaard
> On 26 Jun 2017, at 21:56 , Martin Maechler wrote: > > > Indeed, the fix I've committed reverts almost to the previous > first version of within.data.frame (which is from Peter > Dalgaard, for those who don't know). > Great foresight on my part there, eh? ;-)

Re: [Rd] Odd behaviour in within.list() when deleting 2+ variables

2017-06-26 Thread Martin Maechler
> "PD" == Peter Dalgaard > on Mon, 26 Jun 2017 20:12:38 +0200 writes: >> On 26 Jun 2017, at 19:04 , Martin Maechler >> wrote: >> >>> peter dalgaard on Mon, 26 Jun >>> 2017 13:43:28 +0200

Re: [Rd] suggestion to fix packageDescription() for Windows users

2017-06-26 Thread Nathan Sosnovske via R-devel
I'd be curious to know what others think of Rich's patch. If it is acceptable, I can spend time that I was going to look at it this week on another bug. -Original Message- From: Rich Calaway Sent: Friday, June 23, 2017 6:34 PM To: Nathan Sosnovske ; Duncan Murdoch

Re: [Rd] Odd behaviour in within.list() when deleting 2+ variables

2017-06-26 Thread Peter Dalgaard
> On 26 Jun 2017, at 19:04 , Martin Maechler wrote: > >> peter dalgaard >>on Mon, 26 Jun 2017 13:43:28 +0200 writes: > >> This seems to be due to changes made by Martin Maechler in >> 2008. Presumably this fixed something, but it

Re: [R-pkg-devel] Exporting S3 methods for base generics

2017-06-26 Thread Joris Meys
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:

Re: [R-pkg-devel] Exporting S3 methods for base generics

2017-06-26 Thread Joris Meys
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

Re: [R-pkg-devel] Exporting S3 methods for base generics

2017-06-26 Thread Charles Determan
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

Re: [R-pkg-devel] Exporting S3 methods for base generics

2017-06-26 Thread Charles Determan
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

Re: [R-pkg-devel] Exporting S3 methods for base generics

2017-06-26 Thread Joris Meys
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

Re: [R-pkg-devel] Exporting S3 methods for base generics

2017-06-26 Thread Charles Determan
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

Re: [Rd] Odd behaviour in within.list() when deleting 2+ variables

2017-06-26 Thread Martin Maechler
> peter dalgaard > on Mon, 26 Jun 2017 13:43:28 +0200 writes: > This seems to be due to changes made by Martin Maechler in > 2008. Presumably this fixed something, but it escapes my > memory. Yes: The change set (svn -c46441) also contains the following

[R-pkg-devel] Exporting S3 methods for base generics

2017-06-26 Thread Charles Determan
Greetings R users, I was wondering how others are exporting S3 methods in their packages when the generic is in 'base'. For example, let's say I want to export a new pmax method. The only way I have found to get this to work is by redefining the function with 'UseMethod' and setting the default

[Rd] Suggestion for optim() in stats package

2017-06-26 Thread Marc Girondot via R-devel
When optim() is used with method="BFGS", the name of parameters within the vector are transmitted (see below, first example). When method="Brent", the name of parameter (only one parameter can be fitted with Brent method) is not transmitted. As there is only one, of course, we know which

Re: [Rd] Odd behaviour in within.list() when deleting 2+ variables

2017-06-26 Thread peter dalgaard
This seems to be due to changes made by Martin Maechler in 2008. Presumably this fixed something, but it escapes my memory. However, it seems to have broken the equivalence between within.list and within.data.frame, so now within.list <- within.data.frame does not suffice. The crux of the

[Rd] Odd behaviour in within.list() when deleting 2+ variables

2017-06-26 Thread Hong Ooi via R-devel
The behaviour of within() with list input changes if you delete 2 or more variables, compared to deleting one: l <- list(x=1, y=2, z=3) within(l, { rm(z) }) #$x #[1] 1 # #$y #[1] 2 within(l, { rm(y) rm(z) }) #$x #[1] 1 # #$y #NULL # #$z #NULL When 2 or more variables are