[R] Re: argument ordering (was <blank>)

Paul Murrell paul at stat.auckland.ac.nz
Tue Jul 17 00:59:49 CEST 2001


Hi


---snip---
I am trying to change the number of the ticks on each axis, but every time I
can not succeed and receive the error message shown below even I use the
default values:

>plot.mts(infldata1[,3:4],lty=c(1:2),plot.type="single",lab=c(5,5,7))
   Error in axis(side, at, labels, tick, line, pos, outer, font, vfont, ...)
:
        location and label lengths differ, 6 != 3
---snip---


The problem is that the "lab" parameter is being passed down (via plot.ts)
to axis in a "..." argument, but it is being matched to the "labels"
argument in axis().

In other words, axis() thinks you are saying "labels=c(5, 5, 7)".   This is
not your fault;  it is an unfortunate interaction between partial matching
of argument names and the "..." argument.

A simple workaround would be ...

    op <- par(lab=c(5, 5, 7)
    plot.mts(infldata1[,3:4],lty=c(1:2),plot.type="single")
    par(op)

... a more long-term solution will require some more thought ...

[to R-devel:

    (i) could put the labels argument at the end of the list -- i.e.,
axis(side, at, tick, line, pos, outer, font, vfont, ..., labels) but then
using "lab" as an abbreviation for "labels" would then get consumed as a
par() setting (?)

    (ii) could put explicit "lab" argument in the list too -- i.e.,
axis(side, at, labels, tick, line, pos, outer, font, vfont, lab, ...) (?)

    (iii) ... ?]

Paul



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list