From ripley@stats.ox.ac.uk  Thu Aug  5 17:19:08 1999
From: ripley@stats.ox.ac.uk (Prof Brian D Ripley)
Date: Thu, 5 Aug 1999 17:19:08 +0100 (BST)
Subject: cbind is not generic as claimed, omits labels where S has them
 (PR#239)
In-Reply-To: <x2lnbqgwjc.fsf@blueberry.kubism.ku.dk>
Message-ID: <Pine.GSO.4.05.9908051705140.2936-100000@auk.stats>

On 5 Aug 1999, Peter Dalgaard BSA wrote:

> (1) The docs are clearly wrong (or perhaps rather, wishful thinking)

Sorry, but always the docs are right and the implementation wrong.
That's an axiom of professional computer programming (so I am told
by several ex-professional computer programmers.)

> (2) Cbind should be generic as in Splus
> 
> (3) For the labels, one needs essentially to implement deparse.level
>     or face the horrors of
>     eval(substitute(cbind(a,b,deparse.level=2),list(a=rnorm(10),b=rnorm(10))))

Really? Or try a bit less hard?  Getting the common cases right is not
too hard -- ts.union etc seem normally to be about right, and they have
simple code.

> (4) The dataframe special casing seems to be an evasion. The sticky
>     bit is that one needs to dispatch on *any* argument. For Splus (3.4)
>     compatibility, one has to check each argument for its class
>     method, and if all arguments agree - in the sense that all the
>     arguments that have class methods must have the same one, dispatch
>     to that method. If they disagree, print error message and try
>     default method. 
> 
>     Whoever wrote the code seems to have decided that things would be
>     easier if one assumed that the only method for cbind was
>     cbind.data.frame...
> 
>     Note that by the above logic, if you make a cbind.ts, you can't
>     cbind a time series to a data frame!

That's OK, as I can coerce a data frame to a ts, but in general I want to
cbind ts objects with non-trivial time bases.

I don't think documenting what we have is a good way out here....

-- 
Brian D. Ripley,                  ripley@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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


cbind is not generic as claimed, omits labels where S has them (PR#239)
Prof Brian D Ripley