I have trouble when I make the double for loop for a huge list, the code is like:
bootk=0
bias=0
Nk=0
#datalist = list()
for (i in 1:ksign){
for (j in 1:boottime){
    if (i<=ksign1[j]){
        bias[i]=bias[i]+(bigmatrix[,j]$V1.x[i]-bigmatrix[,j]$V1.y[i])
        Nk[i]=Nk[i]+1
        
      }
    }
  }
ksign and boottime are just 2 numbers here. bigmatrix is like a huge list:
          [,1]          [,2]          [,3]          [,4]          [,5]         
Row.names Character,269 Character,266 Character,283 Character,273 Character,270
V1.x      Numeric,269   Numeric,266   Numeric,283   Numeric,273   Numeric,270  
V2.x      Numeric,269   Numeric,266   Numeric,283   Numeric,273   Numeric,270  
V1.y      Numeric,269   Numeric,266   Numeric,283   Numeric,273   Numeric,270  
V2.y      Numeric,269   Numeric,266   Numeric,283   Numeric,273   Numeric,270  
which is a combination of several list depends on the value of boottime. Here I defined it as 5. But after I ran the code, the output is like:
bias
  [1] 2.521886       NA       NA       NA       NA       NA       NA       NA
  [9]       NA       NA       NA       NA       NA       NA       NA       NA
 [17]       NA       NA       NA       NA       NA       NA       NA       NA
 [25]       NA       NA       NA       NA       NA       NA       NA       NA
 [33]       NA       NA       NA       NA       NA       NA       NA       NA
I should have a list of bias, which the number is the value of ksign. What happened here? Any ideas?
 
    