gavin.simpson at ucl.ac.uk
2007-Mar-02 16:53 UTC
[Rd] Wishlist: Make screeplot() a generic (PR#9541)
Full_Name: Gavin Simpson Version: 2.5.0 OS: Linux (FC5) Submission from: (NULL) (128.40.33.76) Screeplots are a common plot-type used to interpret the results of various ordination methods and other techniques. A number of packages include ordination techniques not included in a standard R installation. screeplot() works for princomp and prcomp objects, but not for these other techniques as it was not designed to do so. The current situation means, for example, that I have called a function Screeplot() in one of my packages, but it would be easier for users if they only had to remember to use screeplot() to generate a screeplot. I would like to request that screeplot be made generic and methods for prcomp and princomp added to R devel. This way, package authors can provide screeplot methods for their functions as appropriate. I have taken a look at the sources for R devel (from the SVN repository) in file princomp-add.R and prcomp.R and it looks a relatively simple change to make screeplot generic. I would be happy to provide patches and documentation if R Core were interested in making this change - I haven't done this yet as I don't want to spend time doing something that might not be acceptable to R core in general. Many thanks, G
Dear List Having not received any comments for or against my proposal to make screeplot() a generic function, I found some time to make the relevant changes to the svn trunk repository (revision 40848). Please find attached a patch against the R svn trunk sources including changes to the relevant help files and NAMESPACE. This builds and passes make check-devel out of the box on my FC4 machine. I took the option of making the default method for screeplot the existing function and the plot methods for princomp and prcomp both call screeplot.default directly. This, I hope, preserves the current behaviour and should be backwards compatible with code/packages/examples/docs that use these functions. One alternative would be to have explicit methods for classes "prcomp" and "princomp" that extract the relevant variances and pass on to screeplot.default for plotting. If this is preferred I can provide a patch for this scenario for consideration? All the best, Gav On Fri, 2007-03-02 at 17:53 +0100, gavin.simpson at ucl.ac.uk wrote:> Full_Name: Gavin Simpson > Version: 2.5.0 > OS: Linux (FC5) > Submission from: (NULL) (128.40.33.76) > > > Screeplots are a common plot-type used to interpret the results of various > ordination methods and other techniques. A number of packages include ordination > techniques not included in a standard R installation. screeplot() works for > princomp and prcomp objects, but not for these other techniques as it was not > designed to do so. The current situation means, for example, that I have called > a function Screeplot() in one of my packages, but it would be easier for users > if they only had to remember to use screeplot() to generate a screeplot. > > I would like to request that screeplot be made generic and methods for prcomp > and princomp added to R devel. This way, package authors can provide screeplot > methods for their functions as appropriate. > > I have taken a look at the sources for R devel (from the SVN repository) in file > princomp-add.R and prcomp.R and it looks a relatively simple change to make > screeplot generic. > > I would be happy to provide patches and documentation if R Core were interested > in making this change - I haven't done this yet as I don't want to spend time > doing something that might not be acceptable to R core in general. > > Many thanks, > > G-- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC [f] +44 (0)20 7679 0565 UCL Department of Geography Pearson Building [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street London, UK [w] http://www.ucl.ac.uk/~ucfagls/ WC1E 6BT [w] http://www.freshwaters.org.uk/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% -------------- next part -------------- A non-text attachment was scrubbed... Name: screeplot.patch Type: text/x-patch Size: 3978 bytes Desc: not available Url : https://stat.ethz.ch/pipermail/r-devel/attachments/20070317/46171f2e/attachment.bin
maechler at stat.math.ethz.ch
2007-Mar-17 19:40 UTC
[Rd] Wishlist: Make screeplot() a generic (PR#9541)
>>>>> "GS" == Gavin Simpson <gavin.simpson at ucl.ac.uk> >>>>> on Sat, 17 Mar 2007 13:02:29 +0000 writes:GS> Dear List GS> Having not received any comments for or against my proposal to make GS> screeplot() a generic function, I found some time to make the relevant GS> changes to the svn trunk repository (revision 40848). GS> Please find attached a patch against the R svn trunk sources including GS> changes to the relevant help files and NAMESPACE. This builds and passes GS> make check-devel out of the box on my FC4 machine. also for me; thank you Gavin! GS> I took the option of making the default method for screeplot the GS> existing function and the plot methods for princomp and prcomp both call GS> screeplot.default directly. This, I hope, preserves the current GS> behaviour and should be backwards compatible with GS> code/packages/examples/docs that use these functions. [[it is still a matter of taste if screeplot.default should be called explicitly, but since this is in the same namespace, it works nicely and slightly more efficiently]] I have committed your patches (+ a NEWS entry) as is, to be there early enough before beta stage. GS> One alternative would be to have explicit methods for classes "prcomp" GS> and "princomp" that extract the relevant variances and pass on to GS> screeplot.default for plotting. If this is preferred I can provide a GS> patch for this scenario for consideration? I'd prefer it in general, but not in this case where the plot.* method for these already use screeplot(); still another matter of taste. Thanks for your contribution. Martin