[R] rbind problem

Matthew Wiener mcw at ln.nimh.nih.gov
Tue Nov 23 17:42:44 CET 1999


In the new version 0.90.0, rbind won't take a vector and a matrix from me,
but works OK if I coerce the vector to a matrix.  The following was run on
a new session (i.e., no prior work), and has been duplicated on 2
machines: an SGI running Irix 6.5, and an Intel box running Red Hat Linux
6.0.

Either case works fine in version 0.65.1.




> t3 <- c(.5, .5)  
> t4 <- matrix(rnorm(8), 4, 2)  
> t3 
[1] 0.5 0.5 
> t4
     [,1]       [,2] 
[1,]  1.0701582 -0.40888504 
[2,] -0.2961581 -1.73051884 
[3,]  0.6191254  0.05958328 
[4,] -1.3844937  0.81863361 
> dim(t3) <- c(1,2)            (make vector a matrix)
> rbind(t3, t4) 
           [,1] [,2] 
[1,]  0.5000000  0.50000000    (so OK when vector coerced)
[2,]  1.0701582 -0.40888504
[3,] -0.2961581 -1.73051884 
[4,]  0.6191254  0.05958328 
[5,] -1.3844937  0.81863361 
> 
> t3 <- c(.5, .5)              (reassign t3 as a vector)
> dim(t3) 
NULL 
> 
> rbind(t3, t4) 

Process R segmentation violation (core dumped) at Tue Nov 23 11:28:05 1999

--------------------------------------------------------------------------

Am I missing something?  Has anyone else come across this problem?  Or is
this a new feature?  I don't see anything in the documentation; indeed,
it says (in the help for cbind and rbind):

When the arguments consist of a mix of matrices and vectors the number of
columns (rosw) of the result is determined by the number of columns (rows)
of the matrix arguments. Any vectors have their values recycled or
subsetted to achieve this length. 

Thanks,

Matt

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



More information about the R-help mailing list