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

About this list Date view Thread view Subject view Author view Other groups

Subject: cbind is not generic as claimed, omits labels where S has them (PR#239)
ripley@stats.ox.ac.uk
Date: Thu 05 Aug 1999 - 21:28:05 EST


Message-Id: <199908051128.NAA28801@pubhealth.ku.dk>

(1) ?cbind claims

     The generic functions `cbind' and `rbind' take a
     sequence of vector and/or matrix arguments and combine
     them as the columns or rows, respectively, of a matrix.

Note:

     The method dispatching is not done via `UseMethod(..)',
     but by C-internal dispatching. Therefore, there's no
     need for, e.g., `rbind.default'.

but my cbind.ts does not get called, and try the following:

cbind.my <- function(...)
{
    stop("used cbind.my")
}
a <- b <- 1:3
cbind(a, b)
class(a) <- "my"
cbind(a, b)
     [,1] [,2]
[1,] 1 1
[2,] 2 2
[3,] 3 3

This is incorrect.

(2) S would give
     a b
[1,] 1 1
[2,] 2 2
[3,] 3 3
(and stop on the second cbind call).

and this discrepancy is hardly an improvement!

Could someone who can understands the c/rbind code please sort this out.
(It looks pretty arcane to me, and surely should not be special-casing data
frames.)

I used both of

> R.version
           _
platform sparc-sun-solaris2.6
arch sparc
os solaris2.6
system sparc, solaris2.6
status
status.rev 0
major 0
minor 64.2
year 1999
month July
day 3
language R

> R.version
           _
platform sparc-sun-solaris2.6
arch sparc
os solaris2.6
system sparc, solaris2.6
status Under development (unstable)
status.rev 0
major 0
minor 65.0
year 1999
month August
day 05
language R

-- 
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:06 EST