title: Error in x[[jj]][iseq] <- vjj : replacement has length zero in R (KlaR package)
body: <p>I have a dataset with 188 columns and 100 rows (plus a header row). I'm trying to apply the <code>kmodes</code> clustering method (from <code>klaR</code> package) in R to this matrix.</p>
  <p>There are two types of data in the array data structure: string and binary. Both have null values.</p>
  <p>For example:</p>
  <pre><code> Q27_history     Q28
        1          &lt;NA&gt; 
      &lt;NA&gt;    yes, sometimes
  </code></pre>
  <p>function to compute total within-cluster sum of square:</p>
  <pre><code>set.seed (96743)
  
  # function to compute total within-cluster sum of square 
  wss &lt;- function(k) {
    sum((kmodes( whois_data, k)$withindiff))
  }
  
  # Compute and plot wss for k = 1 to k = 15
  k.values &lt;- 2:15
  
  # extract wss for 2-15 clusters
  wss_values &lt;- map_dbl(k.values, wss)
  
  print(wss_values)
  </code></pre>
  <p>The text of error:</p>
  <pre><code>Error in x[[jj]][iseq] &lt;- vjj : replacement has length zero
  </code></pre>
  <p>Afret that:</p>
  <pre><code>Error in print(wss_values) :object 'wss_values' is not found
  </code></pre>
  <p>I've tried to put <code>kmodes(na.fill(data, fill=&quot;&quot;), k)</code> in:</p>
  <pre><code>wss &lt;- function(k) {
    sum((kmodes( whois_data, k)$withindiff))
    kmodes(na.fill(data, fill=&quot;&quot;), k)
  }
  </code></pre>
  <p>But after that <code>library(purrr)</code> stop working and does not find variable <code>map_dbl</code></p>
  <p>How should I inline rows with empty data?</p>