Re: [Rd] Bug in xy.coords() or documentation error?

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Sat 21 Jan 2006 - 19:05:50 GMT

If the latest version does not have it then I guess it was not done. I do agree with you that there is a problem and here and think that the code, not just the docs, should be fixed.

On 1/21/06, Gavin Simpson <gavin.simpson@ucl.ac.uk> wrote:
> On Sat, 2006-01-21 at 13:39 -0500, Gabor Grothendieck wrote:
> > I think the docs have been changed for the next vesion
> > of R.
>
> Not in R Version 2.3.0 Under development (unstable) (2006-01-18 r37123)
> downloaded today.
>
> G
>
> >
> > On 1/21/06, Gavin Simpson <gavin.simpson@ucl.ac.uk> wrote:
> > > On Sat, 2006-01-21 at 13:12 -0500, Gabor Grothendieck wrote:
> > > > This was discussed just recently. This is a design
> > > > error but the maintainers claim there are no cases of
> > > > interest where it matters.
> > >
> > > Thanks Gabor,
> > >
> > > I must have missed that discussion whilst I was on vacation. If what you
> > > say was the outcome of that discussion, it still means that the
> > > documentation for xy.coords is in error, as you may *not* provide a
> > > single argument 'x'.
> > >
> > > If the intention is to keep the current behaviour - which is fine - then
> > > the documentation should be changed, perhaps along the lines of:
> > >
> > > x, y: the x and y coordinates of a set of points. Alternatively, a
> > > single object 'x' can be provided if 'y = NULL' is also
> > > supplied.
> > >
> > > 'object' might not be correct here - is a formula an 'object'?
> > >
> > > Cheers,
> > >
> > > Gav
> > >
> > > >
> > > > On 1/21/06, Gavin Simpson <gavin.simpson@ucl.ac.uk> wrote:
> > > > > Hi,
> > > > >
> > > > > I noticed the following problem with xy.coords() in R 2.2.1-patched
> > > > > (version info at the foot of this email) and R 2.3.0 unstable
> > > > > (subversion no: r37123):
> > > > >
> > > > > > xy.coords(x = matrix(1:20, ncol = 2))
> > > > > Error in xy.coords(x = matrix(1:20, ncol = 2)) :
> > > > > argument "y" is missing, with no default
> > > > > > xy.coords(x = matrix(1:20, ncol = 2), y = NULL)
> > > > > $x
> > > > > [1] 1 2 3 4 5 6 7 8 9 10
> > > > >
> > > > > $y
> > > > > [1] 11 12 13 14 15 16 17 18 19 20
> > > > >
> > > > > $xlab
> > > > > [1] "[,1]"
> > > > >
> > > > > $ylab
> > > > > [1] "[,2]"
> > > > >
> > > > > And:
> > > > >
> > > > > > xy.coords(x = data.frame(x = 1:10, y = 1:10))
> > > > > Error in xy.coords(x = data.frame(x = 1:10, y = 1:10)) :
> > > > > argument "y" is missing, with no default
> > > > > > xy.coords(x = data.frame(x = 1:10, y = 1:10), y = NULL)
> > > > > $x
> > > > > [1] 1 2 3 4 5 6 7 8 9 10
> > > > >
> > > > > $y
> > > > > [1] 1 2 3 4 5 6 7 8 9 10
> > > > >
> > > > > $xlab
> > > > > [1] "x"
> > > > >
> > > > > $ylab
> > > > > [1] "y"
> > > > >
> > > > > ... for example.
> > > > >
> > > > > ?xy.coords states:
> > > > >
> > > > > x, y: the x and y coordinates of a set of points. Alternatively, a
> > > > > single argument 'x' can be provided.
> > > > >
> > > > > Given that, I would have thought the above examples would have worked
> > > > > without explicitly passing y = NULL to xy.coords(). However, ?xy,coords
> > > > > later states:
> > > > >
> > > > > If 'y' is 'NULL' and 'x' is a
> > > > >
> > > > > and the examples all illustrate the use of NULL passed as y.
> > > > >
> > > > > Is this a documentation error and a single argument x is not allowed, or
> > > > > is this a bug in the code? Either way, ?xy.coords contradicts itself as
> > > > > one would expect to be able to pass only x given the statement above.
> > > > >
> > > > > If this is a bug in the code, a potential workaround appears to be to
> > > > > change the first line of xy.coords from:
> > > > >
> > > > > if (is.null(y)) {
> > > > >
> > > > > to
> > > > >
> > > > > if (missing(y) || is.null(y)) {
> > > > >
> > > > > but I haven't tested this on anything other than my two examples.
> > > > >
> > > > > I will file a bug report if my observation is correct - but given all
> > > > > the erroneous bug reports lately, I thought I'd try my luck here where
> > > > > an error on my part would not cause the maintainers of the bug tracker
> > > > > any extra work.
> > > > >
> > > > > > version
> > > > > _
> > > > > platform i686-pc-linux-gnu
> > > > > arch i686
> > > > > os linux-gnu
> > > > > system i686, linux-gnu
> > > > > status Patched
> > > > > major 2
> > > > > minor 2.1
> > > > > year 2006
> > > > > month 01
> > > > > day 18
> > > > > svn rev 37123
> > > > > language R
> > > > > > sessionInfo()
> > > > > R version 2.2.1, 2006-01-18, i686-pc-linux-gnu
> > > > >
> > > > > attached base packages:
> > > > > [1] "methods" "stats" "graphics" "grDevices"
> > > > > [5] "utils" "datasets" "base"
> > > > >
> > > > > All the best,
> > > > >
> > > > > Gav
> > > > >
> > > > > --
> > > > > %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> > > > > Gavin Simpson [T] +44 (0)20 7679 5522
> > > > > ENSIS Research Fellow [F] +44 (0)20 7679 7565
> > > > > ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
> > > > > UCL Department of Geography [W]
http://www.ucl.ac.uk/~ucfagls/cv/
> > > > > 26 Bedford Way [W] http://www.ucl.ac.uk/~ucfagls/
> > > > > London. WC1H 0AP.
> > > > > %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> > > > >
> > > > > ______________________________________________
> > > > > R-devel@r-project.org mailing list
> > > > > https://stat.ethz.ch/mailman/listinfo/r-devel
> > > > >
> > > --
> > > %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> > > Gavin Simpson [T] +44 (0)20 7679 5522
> > > ENSIS Research Fellow [F] +44 (0)20 7679 7565
> > > ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
> > > UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/
> > > 26 Bedford Way [W] http://www.ucl.ac.uk/~ucfagls/
> > > London. WC1H 0AP.
> > > %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> > >
> > >
> --
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> Gavin Simpson [T] +44 (0)20 7679 5522
> ENSIS Research Fellow [F] +44 (0)20 7679 7565
> ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
> UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/
> 26 Bedford Way [W] http://www.ucl.ac.uk/~ucfagls/
> London. WC1H 0AP.
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>
>



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sun Jan 22 06:11:33 2006

This archive was generated by hypermail 2.1.8 : Sat 21 Jan 2006 - 20:20:54 GMT