[R] Storing Matrices into Hash
Erik Iverson
iverson at biostat.wisc.edu
Fri Aug 1 04:01:08 CEST 2008
I think a named list is probably the easiest way to start off, something
like:
all_mat <- list(mat1 = mat1, mat2 = mat2)
all_mat$mat2
Gundala Viswanath wrote:
> Hi,
>
> Suppose I have these two matrices (could be more).
> What I need to do is to store these matrices into a hash.
>
> So that I can call back any of the matrix back later.
>
> Is there a way to do it?
>
>> mat_1
> [,1] [,2]
> [1,] 9.327924e-01 0.067207616
> [2,] 9.869321e-01 0.013067929
> [3,] 9.892814e-01 0.010718579
> [4,] 9.931603e-01 0.006839735
> [5,] 9.149056e-01 0.085094444
>
>> mat_2
> [,1] [,2]
> [1,] 9.328202e-01 0.067179769
> [2,] 9.869402e-01 0.013059827
> [3,] 9.892886e-01 0.010711437
> [4,] 9.931660e-01 0.006833979
> [5,] 9.149391e-01 0.085060890
>
>
> This method I have is not favorable
> because it just stack the matrices together as another matrix.
> Makes it hard to get individual matrix later.
>
> all_mat <- NULL
> all_mat <- c(all_mat, mat1,mat2)
>
>
>
> - Gundala Viswanath
> Jakarta - Indonesia
>
> ______________________________________________
> 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