Re: [R] empty array

2008-03-18 Thread Robin Hankin
Hello everyone I know other, more knowledgeable, people have replied to Christophe's question, but perhaps the List would be interested to know that zero-extent arrays are useful (to me at least) because although such an array has no content, the dimname are nevertheless retained: a -

[R] empty array

2008-03-15 Thread Christophe Genolini
Hi the list Is it possible to create an empty matrix ? I do not mean an matrix with a single value that is NA (which is not empty) but a real empty one, with length=0. I do not understand why we have length(numeric()), length(factor()) and length(character()) to zero, and length(array()) to

Re: [R] empty array

2008-03-15 Thread Gabor Csardi
On Sat, Mar 15, 2008 at 04:33:32PM +0100, Christophe Genolini wrote: Hi the list Is it possible to create an empty matrix ? I do not mean an matrix with a single value that is NA (which is not empty) but a real empty one, with length=0. Sure: matrix(nrow=0, ncol=5) [,1] [,2] [,3]

Re: [R] empty array

2008-03-15 Thread Prof Brian Ripley
On Sat, 15 Mar 2008, Gabor Csardi wrote: On Sat, Mar 15, 2008 at 04:33:32PM +0100, Christophe Genolini wrote: Hi the list Is it possible to create an empty matrix ? I do not mean an matrix with a single value that is NA (which is not empty) but a real empty one, with length=0. Sure:

Re: [R] empty array

2008-03-15 Thread John Kane
Will mymatrix - NULL do what you want? --- Christophe Genolini [EMAIL PROTECTED] wrote: Hi the list Is it possible to create an empty matrix ? I do not mean an matrix with a single value that is NA (which is not empty) but a real empty one, with length=0. I do not understand why we

Re: [R] empty array

2008-03-15 Thread Christophe Genolini
John Kane a écrit : Will mymatrix - NULL do what you want? Well, in your code, 'mymatrix' is not a matrix : a-array(dim=c(0,0)) # Solution of Gabor Csardi 0 x 0 matrix class(a) [1] matrix b-NULL class(b) [1] NULL Your definition will probably works in most case, but in S4, the uses of