[R] list element to matrix

2007-09-05 Thread dverzi
I have created a list of matrices using sapply or lapply and wish to extract each of the matrices as a matrix. Some of them are 2x2, 3x3, etc. I can do this one at a time as: M1-as.matrix(D[[1]]) How can repeat this process for an unknown number of entries in the list? In other words, how

[R] match help

2007-09-03 Thread dverzi
In my code, I would like to replace entries in t with entries from a random normal distribution. n-10 nl-round(1.5+rexp(1,rate=2) rate=2)) nl [1] 2 r-1:n s-sort(sample(r,nl)) t-match(r,s) r [1] 1 2 3 4 5 6 7 8 9 10 s [1] 3 8 t [1] NA NA 1 NA NA NA NA 2 NA NA