[R] vectors / matrices

Torsten Hothorn Torsten.Hothorn at rzmail.uni-erlangen.de
Thu Oct 18 16:24:54 CEST 2001


Hi, 

a friend of mine came across this

R> x <- 1:5
R> cbind(x,x)
     x x
[1,] 1 1
[2,] 2 2
[3,] 3 3
[4,] 4 4
[5,] 5 5
R> rbind(x,x)
  [,1] [,2] [,3] [,4] [,5]
x    1    2    3    4    5
x    1    2    3    4    5


x is a vector and therefore has no dim-attribute. Obviously cbind treats x
as a col-vector but rbind treats x as a row-vector, that is: two
functions have a different view on x. I'm sure there is a
good reason for this but I could not find it ...

Torsten

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