title: How to know a dimension of matrix or vector in R?
body: <p>I want to find the function in R which does the same as the function <code>size</code> in Matlab. </p>
  
  <p>In Matlab, if <code>A = [ 1 2 3 4 5]</code>, then <code>size(A) = 1 5</code>.</p>
  
  <p>If <code>A =[ 1 2 3;4 5 6]</code>, then <code>size(A) = 3 3</code>.</p>
  
  <p>In R, I found that the function <code>dim</code> gives the size of a matrix, but it doesn't apply to vectors. </p>
  
  <p>Please help me solve this problem.</p>
  
  <p>Thanks a lot.</p>