[EMAIL PROTECTED] wrote:
> 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 shall I index M1?
>
Hi Diana,
To step through the matrices in your list (assuming that it only has one
level):
for(mat in 1:length(D)) {
<do what you want>
}
Jim
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.