[Rd] Re: [R] Is k equivalent to k:k ?
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Dec 10 16:46:26 CET 2004
On Fri, 10 Dec 2004, Peter Dalgaard wrote:
> Martin Maechler <maechler at stat.math.ethz.ch> writes:
>
>
>> RichOK> "from", "to", "by", "length.out", "along.with"
>> RichOK> ^^^^ ^^^^^
>> RichOK> when the help page for seq documents them as
>> RichOK> "from", "to", "by", "length", and "along"?
>>
>>
>> Well I can explain why this wasn't caught by R's builtin
>> QA (quality assurance) checks:
>>
>> The base/man/seq.Rd page uses both \synopsis{} and \usage{}
>> which allows to put things on the help page that are not checked
>> to coincide with the code...
>> I'm about to fix this (documentation, not code).
>
> In the case of "length", I think there's a historical explanation for
> having the formal argument being a slightly lengthened version of what
> you'd like to use as the actual argument: "length" is the obvious
> choice of name for the argument, but if you used that in older
> versions of S and R then it would mask the length() function and get
> you in all sorts of trouble, or at least spit out a number of annoying
> warning messages. (On a related note, you may have noticed that some
> of the oldtimers still have knee-jerk reactions to people using "c"
> and "t" for variable names). So call it something longer and let
> partial matching allow users to use the short form.
>
> With namespaces, base::length(v) would clear up the issue quite
> nicely, as would the convention of looking for objects of mode
> "function" if it is clear from the context that a function is needed.
> However, seq() predates both of these features as far as I remember.
Indeed, seq() is a Blue Book function, but with args `length' and `along'.
R seems to have followed S-PLUS 3.x in using length.out and along.with:
they were there in 1998-03-06, the earliest copy I can get hold of from
SVN.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list