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