Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 18th, 2012  |  syntax: None  |  size: 0.68 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Argument of length zero in R after if function
  2. gi <- pm%*%t(pm); #creates a 5k by 5k matrix by multiplying matrix by its transpose
  3. dim(gi); # checks dimensions of matrix
  4. ngen <- dim(pm)[1];
  5. select <- matrix(F,ncol=ngen,nrow=ngen);
  6. for(i in 1:(ngen-1)){
  7.     for(ii in (i+1):ngen){
  8.         if(gi[i,ii] < llim){
  9.             next;
  10.         }
  11.         hit1 <- p.sum[i];
  12.         hit2 <- p.sum[ii];
  13.         if(gi[i,ii] >= qmat[hit1,hit2]){
  14.             select[i,ii] <- TRUE;
  15.         }
  16.     }
  17. }
  18.        
  19. Error in if (gi[i, ii] >= qmat[hit1, hit2]) { :
  20.   argument is of length zero
  21.        
  22. m <- matrix(1:12,4)
  23. m[0,3] # integer(0)
  24. if (m[0,3] > 0) 'foo!'
  25. #Error in if (m[0, 3] > 0) "foo!" : argument is of length zero