[R] Confusing concept of vector and matrix in R
chuck at sharpsteen.net
Tue Mar 30 04:47:20 CEST 2010
> Why does R need the concept of "Vector"? In my opinion, it is a useless
> and confusing concept. A vector is simply a special case of a matrix
> whose row or column number is equal to 1. When I take submatrix from one
> matrix and if row or column number is 1, R will automatically convert it
> into a vector. It is very straightforward that a submatrix of a matrix
> should be a matrix. In each time, I have to use as.matrix() to convert
> the vector back to matrix. It is very annoying!
Except that to a computer all "matricies" and "arrays" are just vectors for
which some human arbitrarily declared something like "row break every n
And R can be told not to perform the conversion from sub-matrix to vector,
open the help page for the subset operator:
And play with the drop option.
Undergraduate-- Environmental Resources Engineering
Humboldt State University
View this message in context: http://n4.nabble.com/Confusing-concept-of-vector-and-matrix-in-R-tp1707170p1735190.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help