jeudi 30 mars 2017

R 3.3.3 "Error in for loop - incompatable dimensions"

while (x < as.numeric(s_max)){
 len2<-length(subdata2)
 resize<-approx(seq_along(subdata2), subdata2, n = len2*x)$y
 len<-length(resize)
 initial<-(length(subdata1)*(scale))+step
 for (i in 1:length(initial)){
  testdata3<-testdata1[(initial[i]):len+(initial[i])]
   corl<-cor(testdata3, resize,use = "na.or.complete")
   if(corl > corr) {
    maxes<-c(corl, (len/len2), i)
    write.table(maxes,"a.txt", append = TRUE, quote = FALSE, row.names =   FALSE, col.names = FALSE)

    }
  }
 x<-(x+0.01)
 setTxtProgressBar(pb, x)

I get incompatible dimensions and when I try to fix it I get NAs for "testdata3" any help will be greatly appreciated

Aucun commentaire:

Enregistrer un commentaire