title: "Error: Must subset rows with a valid subscript vector" in preProcess() when using knnImpute
body: <p>I'm using kaggle's pokemon data to practice KNN imputation via <code>preProcess()</code>, but when I did I encountered this following message after the <code>predict()</code> step. I am wondering if I use the incorrect data format or if some columns have inappropriate "class." Below is my code.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>library(dplyr)
  library(ggplot2)
  library(tidyr)
  library(reshape2)
  library(caret)
  library(skimr)
  library(psych)
  library(e1071)
  library(data.table)
  
  
  pokemon &lt;- read.csv("https://www.dropbox.com/s/znbta9u9tub2ox9/pokemon.csv?dl=1")
  
  pokemon = tbl_df(pokemon)
  
  # select relevant features
  
  df &lt;- select(pokemon, hp, weight_kg, height_m, sp_attack, sp_defense, capture_rate)
  
  pre_process_missing_data &lt;- preProcess(df, method="knnImpute")
  classify_legendary &lt;- predict(pre_process_missing_data, newdata = df)</code></pre>
  </div>
  </div>
  </p>
  
  <p>and I received this error message</p>
  
  <pre><code>Error: Must subset rows with a valid subscript vector.
  x Subscript `nn$nn.idx` must be a simple vector, not a matrix.
  Run `rlang::last_error()` to see where the error occurred.
  </code></pre>