Error in sample.int(length(x), size, replace, prob) : cannot take a sample larger than the population when 'replace = FALSE'
<p>I am trying to run SOM from kohonen package. when I use 10x10 dimension. it works, bu when I increase the 2d latent dimension iton 20x20 or bigger, it gave me this below error. can someone help me? why is this happen?. what is the ideal 2D latent dimension if I have 167 data with 9 variables? thank you so much</p>
<pre><code>&gt; dim(data)
[1] 167   9
&gt; dim(data_scale)
[1] 167   9
&gt; class(data)
[1] &quot;data.frame&quot;
&gt; class(data_scale)
[1] &quot;matrix&quot;
&gt; som_grid&lt;-somgrid(xdim = 10, ydim = 10 , topo = &quot;hexagonal&quot;)
&gt; som_model&lt;-som(data_scale, grid=som_grid, rlen=1000, alpha=c(0.05,0.01),n.hood=&quot;circular&quot;, keep.data=TRUE)
&gt; som_grid&lt;-somgrid(xdim = 20, ydim = 10 , topo = &quot;hexagonal&quot;)
&gt; som_grid&lt;-somgrid(xdim = 20, ydim = 20 , topo = &quot;hexagonal&quot;)
&gt; som_model&lt;-som(data_scale, grid=som_grid, rlen=1000, alpha=c(0.05,0.01),n.hood=&quot;circular&quot;, keep.data=TRUE)
</code></pre>
<blockquote>
<p>Error in sample.int(length(x), size, replace, prob) :
cannot take a sample larger than the population when 'replace = FALSE'</p>
</blockquote>