title: dim(X) must have a positive length in R
body: <p>I want to see how many positive and negative I have in a matrix 
  I simply use the following command to get the negative values but I get error</p>
  
  <pre><code>apply(m[,2], 2, function(x) length(x[x&lt;0]))
  </code></pre>
  
  <p>My matrix look like following and named m</p>
  
  <pre><code>    row.names   logFC        AveExpr       t         P.Value    adj.P.Val       B
  1   AFFX    0.254330303 -0.0273913479   2.790941    0.005346628 0.9936675   -2.351052
  2   AFFX-   0.144249680 -0.0081323315   2.744752    0.006154509 0.9936675   -2.470447
  3   AFFX-T  0.129062121 -0.0072936248   2.730567    0.006423832 0.9936675   -2.506720
  4   AFFy    0.105893838 -0.0084886157   2.672831    0.007632963 0.9936675   -2.652445
  5   AFfm    0.146253131 -0.0123657559   2.617852    0.008970330 0.9936675   -2.788357
  6   20uy    1.033582071 0.9319210383    2.476302    0.013425076 0.9936675   -3.125444
  7   2196    0.099556431 -0.0061285974   2.451229    0.014392052 0.9936675   -3.183222
  
  
  
  **Error in apply(m[, 2], 2, function(x) length(x[x &lt; 0])) : 
    dim(X) must have a positive length**
  </code></pre>