Re: [R] Confusing concept of vector and matrix in R

2010-04-27 Thread Patrick Burns
Two points: the 'drop' argument is not unrecognized, just superfluous. There are one-dimensional cases where the 'drop' argument is not superfluous: factor(letters)[1:5, drop=TRUE] factor(letters)[1:5, drop=FALSE] So my guess is that it would be an exceptional amount of work to get such a warn

Re: [R] Confusing concept of vector and matrix in R

2010-04-26 Thread Peter Ehlers
On 2010-04-26 20:05, Matthew Keller wrote: Rolf: "Well then, why don't you go away and design and build your own statistics and data analysis language/package to replace R?" What a nice reply! The fellow is just trying to understand R. That response reminds me of citizens of my own country who c

Re: [R] Confusing concept of vector and matrix in R

2010-04-26 Thread Charles C. Berry
On Mon, 26 Apr 2010, Stuart Andrews wrote: Thanks Charles, for clarifying. My statement holds for matrices, which are 2 dimensional. And, as you mentioned, a single index implies vector indexing where the drop argument doesn't make sense. I am somewhat relieved, given this new understandi

Re: [R] Confusing concept of vector and matrix in R

2010-04-26 Thread Stuart Andrews
Thanks Charles, for clarifying. My statement holds for matrices, which are 2 dimensional. And, as you mentioned, a single index implies vector indexing where the drop argument doesn't make sense. I am somewhat relieved, given this new understanding. But I am still puzzled as to why R

Re: [R] Confusing concept of vector and matrix in R

2010-04-26 Thread Matthew Keller
Rolf: "Well then, why don't you go away and design and build your own statistics and data analysis language/package to replace R?" What a nice reply! The fellow is just trying to understand R. That response reminds me of citizens of my own country who cannot abide by any criticism of the USA: "If

Re: [R] Confusing concept of vector and matrix in R

2010-04-26 Thread Charles C. Berry
On Mon, 26 Apr 2010, Stu wrote: Hi all, One subtlety is that the drop argument only works if you specify 2 or more indices e.g. [i, j, ..., drop=F]; but not for a single index e.g [i, drop=F]. Wrong. a <- structure(1:5,dim=5) dim(a) [1] 5 dim(a[2:3,drop=F]) # don't drop regardless [1] 2

Re: [R] Confusing concept of vector and matrix in R

2010-04-26 Thread Stu
Hi all, One subtlety is that the drop argument only works if you specify 2 or more indices e.g. [i, j, ..., drop=F]; but not for a single index e.g [i, drop=F]. Why doesn't R complain about the unused "drop=F" argument in the single index case? Cheers, - Stu a = matrix(1:10, nrow=1) b = matrix(

Re: [R] Confusing concept of vector and matrix in R

2010-04-01 Thread Johannes Huesing
Rolf Turner [Tue, Mar 30, 2010 at 09:48:12PM CEST]: [...] > Who designed Excel? Among others, Joel Spolsky. Is that an appeal to authority? -- Johannes Hüsing There is something fascinating about science.

Re: [R] Confusing concept of vector and matrix in R

2010-03-30 Thread lith
> Reframe the problem. Rethink why you need to keep dimensions. I never ever > had to use drop. The problem is that the type of the return value changes if you happen to forget to use drop = FALSE, which can easily turn into a nightmare: m <- matrix(1:20, ncol=4) for (i in seq(3, 1, -1)) { p

Re: [R] Confusing concept of vector and matrix in R

2010-03-30 Thread Rolf Turner
On 30/03/2010, at 10:04 PM, Barry Rowlingson wrote: > On Tue, Mar 30, 2010 at 2:42 AM, Rolf Turner wrote: > >> Well then, why don't you go away and design and build your own statistics and >> data analysis language/package to replace R? You can then make whatever >> design decisions you like,

Re: [R] Confusing concept of vector and matrix in R

2010-03-30 Thread Mario Valle
Reframe the problem. Rethink why you need to keep dimensions. I never ever had to use drop. My .02 something mario Barry Rowlingson wrote: > On Tue, Mar 30, 2010 at 2:42 AM, Rolf Turner wrote: > >> Well then, why don't you go away and design and build your own statistics

Re: [R] Confusing concept of vector and matrix in R

2010-03-30 Thread Barry Rowlingson
On Tue, Mar 30, 2010 at 2:42 AM, Rolf Turner wrote: > Well then, why don't you go away and design and build your own statistics and > data analysis language/package to replace R?  You can then make whatever > design decisions you like, and you won't have to live with the design > decisions > mad

Re: [R] Confusing concept of vector and matrix in R

2010-03-29 Thread Sharpie
yehengxin wrote: > > 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 auto

Re: [R] Confusing concept of vector and matrix in R

2010-03-29 Thread Gabor Grothendieck
Actually R looks at it the other way around. It regards a matrix as a special case of a vector. A vector has no dimensions. A vector with dimensions is an array. An array with two dimensions is a matrix. Try using drop=FALSE like this: m <- matrix(1:6, 3) m[, 2, drop = FALSE] On Mon, Mar 29,

Re: [R] Confusing concept of vector and matrix in R

2010-03-29 Thread Steve Lianoglou
> 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 i

Re: [R] Confusing concept of vector and matrix in R

2010-03-29 Thread Rolf Turner
On 30/03/2010, at 12:13 PM, yehengxin wrote: > > 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 col

[R] Confusing concept of vector and matrix in R

2010-03-29 Thread yehengxin
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 v