Displaying 1 result from an estimated 1 matches for "criculation".
Did you mean:
circulation
2012 Apr 06
2
Sincere inquiry about “subscript out of bounds” error in R
...eed to caculate A2
base on A and X1(4500*4500).Here are the codes
A2<-matrix(4500,500)
for(i in 1:4500){
for(j in 1:500){
A2[i,j]<-(A[X1[i,2],j]+A[X1[i,3],j])/2
}
}
and error happened like this:Error in A2[i, j] <- (A[X1[i, 2], j] + A[X1[i, 3], j])/2 : subscript out of bounds
I check the criculation number in for loop and it is perfect match with the dimension of matrix A and X1. I do not know how this error happened? And anther inportant question is that how can I build a matrix with very larger dimension which can not allocate in R£®Error in matrix(, 45500, 45500) : cannot allocate vector o...