Re: [R-pkg-devel] Redefinition of generic for plot function breaks plot.formula

2015-09-01 Thread Kevin Ushey
FWIW, it's a very _very_ bad idea to add methods to S3 generics for classes you don't 'own'. Some code might be written with the expectation that `plot(df)` actually does dispatch to `plot.default`. This implies that simply loading your package would break code in surprising ways. I would strongly

Re: [R-pkg-devel] Redefinition of generic for plot function breaks plot.formula

2015-09-01 Thread Benjamin Hofner
Dear Gavin, you and Hadley seem to be right. It looks like a problem which is buried deeper within R and the method dispatch. It seems like I have to reintroduce the class labeled.data.frame and plot.labeled.data.frame. However, I will post on R-devel to try to understand this issue. Thanks

Re: [R-pkg-devel] Redefinition of generic for plot function breaks plot.formula

2015-09-01 Thread Gavin Simpson
It's not just plot.formula that is broken; plot.lm is dead too for example. It's seems that just unexported methods fail to be called. This works plot(ts(1:100)), correctly calling the plot.ts method. What you must be doing overwriting the plot generic seems to be clobbering S3 dispatch or killing

Re: [R-pkg-devel] Redefinition of generic for plot function breaks plot.formula

2015-09-01 Thread William Dunlap
Try giving y a default value, NULL, in your plot.default: plot.default <- function(x, y=NULL, ...) graphics::plot(x, y, ...) Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Aug 31, 2015 at 7:37 PM, Gavin Simpson wrote: > Why do you even need to take over `plot`, `plot.default`?

Re: [R-pkg-devel] Redefinition of generic for plot function breaks plot.formula

2015-09-01 Thread Benjamin Hofner
I am using it this way as I want to be able to plot data.frames but have a better display and more options. Thus, using plot.data.frame seems rather natural. A different function or new classes are just a work around. I do not want to use a new class as these functions should work on ANY data f

Re: [R-pkg-devel] Redefinition of generic for plot function breaks plot.formula

2015-09-01 Thread Gavin Simpson
...or have an object that is a data.frame but to which you add an additional class class(obj) <- c("my_df", "data.frame") Then you can include plot.my_df() in your package, plus a function to create a my_df object from a data frame, and you don't have to worry about all this and your objects will

Re: [R-pkg-devel] Redefinition of generic for plot function breaks plot.formula

2015-09-01 Thread Hadley Wickham
Why don't you just create your own function? Hadley On Tue, Sep 1, 2015 at 8:08 AM, Benjamin Hofner wrote: > Dear Gavin, > > unfortunately, I cannot overwrite plot.data.frame only. If I do this I > get the following warning from R CMD check: > > * checking use of S3 registration ... WARNING > Re

Re: [R-pkg-devel] Define S4 method for generic in other package

2015-09-01 Thread Thierry Onkelinx
Hi Hadley, Thanks for the workaround. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician a

Re: [R-pkg-devel] Define S4 method for generic in other package

2015-09-01 Thread Hadley Wickham
Ah, the problem is because of roxyen2 because: * To document your code, roxygen2 needs to load it first * But it can't load it without the definition of git2r::pull So you're stuck in a bit of a vicious circle. I usually break out of this circle by temporarily patching the NAMESPACE by hand (in t

Re: [R-pkg-devel] Redefinition of generic for plot function breaks plot.formula

2015-09-01 Thread Benjamin Hofner
Dear Gavin, unfortunately, I cannot overwrite plot.data.frame only. If I do this I get the following warning from R CMD check: * checking use of S3 registration ... WARNING Registered S3 method from a standard package overwritten by 'papeR': method from plot.data.frame graphics The reason for t

Re: [R-pkg-devel] Problem with Description File

2015-09-01 Thread Glenn Schultz
I solved the problem. By copying the description file from the R library into the project directory. Then everything started working Glenn Sent from my iPhone > On Aug 30, 2015, at 1:55 AM, Uwe Ligges > wrote: > > > >> On 30.08.2015 00:37, Glenn Schultz wrote: >> Hi All, >> >> I am gettin

Re: [R-pkg-devel] Define S4 method for generic in other package

2015-09-01 Thread Thierry Onkelinx
Dear Hadley, I've put a reproducible example at https://github.com/ThierryO/testS4 Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Ander