[R] is it possible to form matrix of matrices...and multiple arrays
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Sep 29 10:59:26 CEST 2005
On Thu, 29 Sep 2005 vincent at 7d4.com wrote:
> booop booop a écrit :
>
>> 1...........Kindly tell me is it possible to form
>> a matrix which contains a no of matrices.. for eg..
>> if a,b,c,d are matrices....
>> and e is a matrix which contains a,b,c,d as rows and columns..
>
> I don't think you can use matrix() to store other matrix() inside.
> But array() is a solution to store matrix() inside.
> (At least I have use it).
You _can_ do this with matrix() (although that was not quite what was
asked). Try
a <- b <- c <- d <- matrix(1:4, 2, 2)
e <- matrix(list(a,b,c,d), 2,2)
e
e[1,2][[1]]
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list