cbind is not generic as claimed, omits labels where S has them (PR#241)
ripley@stats.ox.ac.uk
ripley@stats.ox.ac.uk
Fri, 6 Aug 1999 07:50:50 +0200 (MET DST)
On Fri, 6 Aug 1999 ihaka@stat.auckland.ac.nz wrote:
> On Fri, Aug 06, 1999 at 12:08:05AM +0200, Peter Dalgaard BSA wrote:
> > Ross Ihaka <ihaka@stat.auckland.ac.nz> writes:
> >
> > I played around with this earlier today. There's nothing special about
> > dataframes, S does the same with any classed object. I.e.
> >
> > class(b)<-"my"
> > cbind.my<-function(...)match.call()
> >
> > cbind(a,b)
> >
> > will dispatch cbind.my
>
> I played some more. I think data frames are special somehow.
>
> S> x <- factor(1:10)
> S> y <- data.frame(1:10)
> > class(x)
> [1] "factor"
> S> class(y)
> [1] "data.frame"
> S> class(cbind(x,y))
> [1] "data.frame"
> S> class(cbind(y,x))
> [1] "data.frame"
>
> They seem to overpower other class arguments too.
Once again, there is a difference between what S documents it does and what
it actually does. The on-line help says:
Returns a matrix that is pieced together from several
vectors and/or matrices. The functions cbind and rbind are
generic (relative to their first argument). In particular,
there are cbind and rbind methods for classes in the
Matrix library.
I would settle for that. I think what in part is going is that the
one method, in particular the default method, may use another method.
--
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._