title: Error converting 2D matrix to 3D array in R
body: <p>I am a master’s student trying to use R for my thesis, but I am extremely new to R and I don’t have any programming experience, so please be gentle! I have a bunch of 3D coordinate data that I am trying to use in the {geomorph} package to run standard geometric morphometric analyses. I have split the data into smaller .csv files for convenience. </p>
  
  <p>I have set up the data files in the manner of:</p>
  
  <pre><code>             X1  - Y1 - Z1  - X2 - Y2 - Z2 - … - Z215
  [Indiv.1]    323 - 87 - 68 - 323 - 87 - 68 -   -  0
  
  [Indiv.2]    363 - 88 - 81 - 363 - 88 - 81 -   - 77
  
  [Indiv.3]    335 - 77 - 70 - 335 - 77 - 70 -   -  0
  
  [Indiv.4]    359 - 71 - 81 - 359 - 71 - 81 -   -  0
  
    … 
  
  [Indiv.50]   366 - 71 - 92 - 367 - 72 - 91 -   -  0
  </code></pre>
  
  <p>I import to R using <code>read.table</code> just fine (with dimensions 50 x 645), and I can even convert the resulting data frame into a matrix using <code>as.matrix</code> (maintaining the 50 x 645 dimensions). However, when I go to convert the data into an array (dimensions 215 x 3 x 50) using <code>arrayspecs</code> {geomorph}, I get more than 50 warnings saying that the "data length is not a sub-multiple or multiple of the number of rows". I have been using </p>
  
  <pre><code>&gt; WM.array&lt;-arrayspecs(WM.mat,215,3,byLand=F)
  </code></pre>
  
  <p>But every time I run this command I get the warnings “data length is not a sub-multiple or multiple of the number of rows". I believe {geomorph} wants the data in a 3D array with 3 columns (X,Y,Z) and 215 rows (the max number of coordinate points), and the third dimension is the 50 individuals.</p>
  
  <p>Any help on resolving this would be much appreciated, as I cannot find references for actually resolving this error (at least none that are understandable to me). Thanks in advance.</p>