Re: [R] Problem with mutli-dimensional array

2012-10-04 Thread Loukia Spineli
Thank you very much!! Apparently, If I had defined my "main" variable (results) as a list a priori, I hadn't had consumed so much time writing and running codes after codes! Your comments were very useful both for the code and my document! Thank you! On Wed, Oct 3, 2012 at 4:35 PM, Rui Barradas w

Re: [R] Problem with mutli-dimensional array

2012-10-03 Thread Rui Barradas
Hello, I'm glad it helped. Now you have what is a data structure problem. The computations are the same but in a different output. First of all a terminology issue. In R the correct names for the data structures you've refered to are 'list', 'matrix' and 'array'. To make it short, vector -

Re: [R] Problem with mutli-dimensional array

2012-10-03 Thread Loukia Spineli
Thank you very much for your suggestions. They both worked! Actually I am trying to make an array of length 7, where each array contains a different number of 2 by 2 matrices. The vector "n" defines the different number of matrices across the arrays. Therefore, the parameter "l" has to change in e

Re: [R] Problem with mutli-dimensional array

2012-10-02 Thread Rui Barradas
Hello, See if this is it. Nx <- rep(0,length(x)) Ny <- rep(0,length(y)) n <- (x+1)*(y+1) results <- array(0, dim=c(2,2,64,7)) # l <- 1 # <--- This changed place for(i in 1:length(x)){ Nx[i] <- length(1:(x[i]+1)) Ny[i] <- length(1:(y[i]+1)) l <- 1 # <--

Re: [R] Problem with mutli-dimensional array

2012-10-02 Thread Berend Hasselman
On 02-10-2012, at 16:20, Loukia Spineli wrote: > I want to make a multi-dimensional array. To be specific I want to make the > following array > > results<-array(0,dim=c(2,2,64,7)) > > This is the code I have created but it gives no result due to the error > "subscript out of bound". > > x<-r

[R] Problem with mutli-dimensional array

2012-10-02 Thread Loukia Spineli
I want to make a multi-dimensional array. To be specific I want to make the following array results<-array(0,dim=c(2,2,64,7)) This is the code I have created but it gives no result due to the error "subscript out of bound". x<-rep(7,7) # Missingness in intervention y<-rep(7,7) # Missingness in