Re: [R] generating many matrices

2007-06-06 Thread hadley wickham
On 6/6/07, Keun-Hyung Choi <[EMAIL PROTECTED]> wrote: > I'd like to generate many matrices (let's say 100 matrices of 4x4), of which > diagonal elements are being drawn from each set of sample of known > distribution. > > What would be the best way? I've been trying to find any previous threads >

Re: [R] generating many matrices

2007-06-06 Thread jim holtman
Is this what you want? x <- diag(4) # 4x4 matrix result <- list() # list to store the 100 matrices for (i in 1:100){ diag(x) <- runif(4) # fill with random values result[[i]] <- x # save the result } On 6/5/07, Keun-Hyung Choi <[EMAIL PROTECTED]> wrote: > > I'd like to generate ma

[R] generating many matrices

2007-06-06 Thread Keun-Hyung Choi
I'd like to generate many matrices (let's say 100 matrices of 4x4), of which diagonal elements are being drawn from each set of sample of known distribution. What would be the best way? I've been trying to find any previous threads for this topic, but haven't been able to find one. Thanks. Ke