title: How to plot a SVM model in R
body: <p>I have a data frame with two classes(0 and 1). Using the dataframe I tried to build and train a SVM model. I used the following code</p>
  
  <pre><code>class1.trainset&lt;-data[-class1.testindex,]
  class1.trainset &lt;- data.matrix(class1.trainset)
  class1.svm.model &lt;- svm(Class ~ ., data = class1.trainset,cost=1:100, cross=10,type="C-classification",kernel="radial",na.action=na.omit)
  print(class1.svm.model)
  plot(class1.svm.model, class1.trainset)
  </code></pre>
  
  <p>But I am unable to plot the SVM model,it shows an error</p>
  
  <pre><code>Error in plot.svm(class1.svm.model, class1.trainset) : missing formula.
  </code></pre>
  
  <p>I tried searching for solution and got this one</p>
  
  <p><a href="https://stackoverflow.com/questions/25716998/error-in-plot-formula-missing">Error in plot, formula missing</a></p>
  
  <p>this showed: I need to define X and Y. But I have 15000 columns in the dataset, how do I define my X and Y using the mentioned code.</p>
  
  <pre><code>cplus&lt;-cats
  cplus$Oth&lt;-rnorm(nrow(cplus))
  m2 &lt;- svm(Sex~., data = cplus)
  plot(m2, cplus) #error
  plot(m2, cplus, Bwt~Hwt) #Ok
  plot(m2, cplus, Hwt~Oth) #Ok
  </code></pre>
  
  <p>And here cplus has only 4 columns, I have 15000 columns</p>
  
  <p>Please help me solve the issue</p>