From thomas@biostat.washington.edu  Tue Apr  8 17:47:59 1997
From: thomas@biostat.washington.edu (Thomas Lumley)
Date: Tue, 8 Apr 1997 09:47:59 -0700 (PDT)
Subject: R-alpha: rbind
In-Reply-To: <9704010823.AA00318@>
Message-ID: <Pine.SUN.3.91.970408094156.9023A-100000@chekov>

rbind() does something strange to dimnames

R : Copyright 1997, Robert Gentleman and Ross Ihaka
Version 0.50 Beta (April 1, 1997)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type "license()" for details.

> test1 <- data.frame(time=  c(4, 3,1,1,2,2,3),
   +     status=c(1,NA,1,0,1,1,0),
  +     x=     c(0, 2,1,1,1,0,0))
> temp<-as.matrix(test1)
> dimnames(temp)
[[1]]
NULL

[[2]]
[1] "time"   "status" "x"     

> temp<-rbind(temp,temp)
Error: invalid type for dimnames: must be a list
> dimnames(temp)
[[1]]
NULL
Segmentation fault (core dumped)

Part of the problem is that as.matrix() doesn't set dimnames()[[1]]. If I 
set this by hand everything works. Even so, the rbind function should 
succeed or fail -- it shouldn't mutilate its arguments like this.


Thomas Lumley
------------------------------------------------------+------
Biostatistics		: "Never attribute to malice what  :
Uni of Washington	:  can be adequately explained by  :
Box 357232		:  incompetence" - Hanlon's Razor  :
Seattle WA 98195-7232	:				   :
------------------------------------------------------------

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


R-alpha: rbind
Thomas Lumley