rbind problem (PR#338)

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

Subject: rbind problem (PR#338)
mcw@ln.nimh.nih.gov
Date: Wed 24 Nov 1999 - 02:43:17 EST


Message-Id: <199911231643.RAA26680@pubhealth.ku.dk>

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-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:10 EST