Re: [R] question about matrix

2004-02-16 Thread Spencer Graves
outer(0:2, 1:2, "^") [,1] [,2] [1,]00 [2,]11 [3,]24 Is this what you want? spencer graves Cynthia He wrote: Hello there, How to write this matrix in R? The "^" sign is a power symbol. Thanks a lot! 0^1 0^2 . 0^n 1^1 1^2 .

Re: [R] question about matrix

2004-02-16 Thread Douglas Bates
Cynthia He <[EMAIL PROTECTED]> writes: > How to write this matrix in R? The "^" sign is a power symbol. > > Thanks a lot! > > > 0^1 0^2 . 0^n > 1^1 1^2 . 1^n > 2^1 2^2 . 2^n > > ..

RE: [R] question about matrix

2003-11-12 Thread Gabor Grothendieck
You could consider storing your data in 3d array. If A and B are your matrices of first and second numbers, respectively, with both being of the same shape, then: C <- array(c(A,B), dim=c(dim(A),2)) gives you a 3d array. For example, C[,,1] is A C[,,2] is B C[2,1,] is the the v

Re: [R] question about matrix

2003-11-12 Thread Thomas W Blackwell
Mikyoung - All answers are "yes", but IMHO you are trying to be too clever with your data structure. Programming is *much* easier if you keep things simple. Specifically: (1) The function matrix() will happily build you a matrix of type "list", with each element of the list occupying one ce