[R] How to store an array like this?

Linlin Yan yanlinlin82 at gmail.com
Sat Feb 20 08:34:16 CET 2010


It's not an array, but a list:
lapply(2:n, function(x) matrix(1:x^2,x))

On Sat, Feb 20, 2010 at 3:17 PM, song song <rprojecthelp at gmail.com> wrote:
> maybe its not an array
>
> like
>
> m[1]=matrix(1:4,2,2)
> m[2]=matrix(1:9,3,3)
> .
> .
> .
> m[k]=matrix(1:k^2,k,k)
>
> likes
>
> for (k in 1:n){
>  s=matrix(1:k^2,k,k)
> }
>
> how to store s like s[1], s[2] ....... so that I can use it in other place?
>
> thanks!
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.
>



More information about the R-help mailing list