Hi Wesley,

Try this (untested):

s <- array(0, dim = c(2, 2, 4))

for(i in 1:4)

  s[, ,i] <- read_matrix(a, 2, 2)


Another (untested) option wold be

s0 <- lapply(1:4, function(i) read_matrix(a, 2, 2))
s0

HTH,
Jorge



On Mon, Sep 27, 2010 at 6:12 AM, wesley mathew <> wrote:

> Dear All
>
> I want to store matrix in an array
> Suppose  s<-array(0,4)
> for(i in 1:4)
> s[i] <- read_matrix(a,2,2)
> But the error - number of items to replace is not a multiple of replacement
> length.
> Can you suggest me any alternative method for storing a matrix in an array.
> Thanks In advance.
> Kind Regards
> Wesley C Mathew
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to