title: Arrange multiple (32) .png files in a grid
body: <p>I've been pulling my hair out for the past week trying to figure out elementary R coding but can't seem to get anywhere (haven't used R since 2013 not that its a great excuse).</p>
  
  <p>All I want is a <strong>4x8 grid made up of 32 .png files</strong> (maps I've made), and I want to do it without loading one image file at a time (<a href="http://www.statmethods.net/advgraphs/layout.html" rel="noreferrer">http://www.statmethods.net/advgraphs/layout.html</a>).</p>
  
  <p>So I think I can load the images within the folder writing (please correct me if my beliefs are bs)</p>
  
  <pre><code>img &lt;- list.files(path='c:/a',patt='compo[0-32].*',full.names=T)
  </code></pre>
  
  <p>Then I was thinking maybe in the lines of  <code>par(mfrow=c())</code>, <code>layout</code>, <code>grid.arrange</code> (<a href="https://stackoverflow.com/questions/18852395/writing-png-plots-into-a-pdf-file-in-r">writing png plots into a pdf file in R</a>), <code>grid.raster</code> (<a href="https://stackoverflow.com/questions/15221988/how-to-join-efficiently-multiple-rgl-plots-into-one-single-plot">How to join efficiently multiple rgl plots into one single plot?</a>) - which I've read up on and experimented with accordingly not resulting in anything worthwhile..</p>
  
  <p>The latter I employed only with the following outcome <img src="https://i.stack.imgur.com/CRBYL.png" alt="enter image description here"></p>
  
  <p>It made me giggle.
  I don't really think <code>lattice</code> is the way to go anyway.</p>
  
  <p>Any help would be greatly appreciated!</p>