From p.dalgaard at biostat.ku.dk  Fri Dec 10 14:41:02 2004
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Fri Dec 10 14:41:13 2004
Subject: [Rd] Re: [R] Is  k  equivalent to  k:k ?
In-Reply-To: <16825.24334.69465.599617@gargle.gargle.HOWL>
References: <200412100137.iBA1bGMV054978@atlas.otago.ac.nz>
	<16825.24334.69465.599617@gargle.gargle.HOWL>
Message-ID: <x2fz2ejmoh.fsf@biostat.ku.dk>

Martin Maechler <maechler@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.


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907


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