title: How to overcome "Error in .local(object, ...) : test vector does not match model !"?
body: <p>I removed 100 records from the original data set, then rebuilt a SVM model using the following coding.</p>
  
  <pre><code>uk&lt;-read.csv("Riskx.csv", header=TRUE, sep=",")
  attach(uk)
  library(e1071)
  library(kernlab)
  index&lt;-1:nrow(uk)
  testindex&lt;-sample(index, trunc(length(index)/3))
  testset&lt;-uk[testindex,]
  trainset&lt;-uk[-testindex,]
  model&lt;-ksvm(Risk~, data = trainset, type = "nu-svc")
  pred&lt;-predict(model, testset)
  table(pred, testset$Risk)
  summary(testset$Risk)
  </code></pre>
  
  <p>NOW, I want to bring in those 100 records I set aside from training/testing the new model and check how well the model can identify and classify those 100 records which it has not seen before. So I did the following coding.</p>
  
  <pre><code>testset&lt;-read.csv(“Validation.csv”, header=TRUE, sep=”,”)
  Pred1&lt;-predict(model4, testset)
  </code></pre>
  
  <p>But R, gives me the following error:</p>
  
  <pre><code>Error in .local(object, …) : test vector does not match model !
  </code></pre>
  
  <p>Any idea how I could over come this error? The test set used to build the model has 466 records. Therefore I tried duplicating the validation test to 466 as well, but it still gives the same error.</p>