Skip to content
Prev 306754 / 398506 Next

Problem with mutli-dimensional array

On 02-10-2012, at 16:20, Loukia Spineli <spineliloukia26 at gmail.com> wrote:

            
If you had inserted this line

            cat("i=",i,"l=",l,"j=",j,"k=",k,"\n")

before the assignment to results[,,l,i] in the inner loop you could have quite easily seen what the problem is.
The counter l (letter el) keeps on increasing in your code and when it reaches 65 R will complain.

So at an appropriate place in the code you need to reset l to 1.
I suggest you move the assignment l<-1 to just before the  line with for( j in 1:Nx[i]) ...
Whether the results are what you desire is up to you to decide.

Please use some more whitespace  and do some indenting in your code. As presented it is unreadable.

Berend