[R] store matrix in an arrary
Edwin Groot
edwin.groot at biologie.uni-freiburg.de
Mon Sep 27 12:27:56 CEST 2010
On Mon, 27 Sep 2010 11:12:26 +0100
wesley mathew <wesleycmathew at gmail.com> 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
>
Wesley,
I don't know what your read_matrix() function is doing.
What you made is a 1-dimensional array of 4 elements. If your
read_matrix() function returns more than one element per call, that is
the source of your error message. It means you tried to store something
in s[] that goes beyond its dimensions.
Edwin
> ______________________________________________
> 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.
--
Dr. Edwin Groot, postdoctoral associate
AG Laux
Institut fuer Biologie III
Schaenzlestr. 1
79104 Freiburg, Deutschland
+49 761-2032945
More information about the R-help
mailing list