>>>>> "Torsten" == Torsten Hothorn <Torsten.Hothorn
at rzmail.uni-erlangen.de> writes:
Torsten> Hi,
Torsten> a friend of mine came across this
R> x <- 1:5
R> cbind(x,x)
Torsten> x x
Torsten> [1,] 1 1
Torsten> [2,] 2 2
Torsten> [3,] 3 3
Torsten> [4,] 4 4
Torsten> [5,] 5 5
R> rbind(x,x)
Torsten> [,1] [,2] [,3] [,4] [,5]
Torsten> x 1 2 3 4 5
Torsten> x 1 2 3 4 5
Torsten> x is a vector and therefore has no dim-attribute. Obviously
Torsten> cbind treats x as a col-vector but rbind treats x as a
Torsten> row-vector, that is: two functions have a different view on
Torsten> x. I'm sure there is a good reason for this but I could not
Torsten> find it ...
This*) has been the ``S view'' on vectors forever, and rightly so IMO.
BTW, the same has been true for APL which in some sense was mother to S,
Matlab, etc. It might well be that matlab / octave differ here, but I *do*
prefer the S way quite a bit.
*) Losely speaking:
``A vector used in array context is coerced to whatever array is
reasonable''
Martin Maechler <maechler at stat.math.ethz.ch>
http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum LEO D10 Leonhardstr. 27
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1228 <><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._