[Rd] Re: [R] Is k equivalent to k:k ?

Martin Maechler maechler at stat.math.ethz.ch
Fri Dec 10 15:44:29 CET 2004


>>>>> "Duncan" == Duncan Murdoch <murdoch at stats.uwo.ca>
>>>>>     on Fri, 10 Dec 2004 08:38:34 -0500 writes:

    Duncan> On Fri, 10 Dec 2004 09:32:14 +0100, Martin Maechler
    Duncan> <maechler at stat.math.ethz.ch> wrote :

    RichOK> If you want to pass seq(length=n) to a .C or
    RichOK> .Fortran call, it's not helpful that you can't tell
    RichOK> what the type is until you know n!  It would be nice
    RichOK> if seq(length=n) always returned the same type.  I
    RichOK> use seq(length=n) often instead of 1:n because I'd
    RichOK> like my code to work when n == 0; it would make life
    RichOK> simpler if seq(length=n) and 1:n were the same type.
    >> 
    >> now if that really makes your *life* simpler, what does that
    >> tell us about your life  ;-) :-)
    >> 
    >> But yes, you are right.  All should return integer I think.

    Duncan> Yes, it should be consistent, and integer makes sense here.

the R-devel version now does;  and so does  seq(along = <.>)

Also ?seq {or ?seq.default} now has the value section as

> Value:

>      The result is of 'mode' '"integer"' if 'from' is (numerically
>      equal to an) integer and, e.g., only 'to' is specified, or also if
>      only 'length' or only 'along.with' is specified.

which is correct {and I hope does not imply that it gives *all* cases of
an integer result}.

Martin



More information about the R-devel mailing list