title: R object is not a matrix
body: <p>I am new to R and trying to save my svm model in R and have read the documentation but still do not understand what is wrong.</p>
  
  <p>I am getting the error "object is not a matrix" which would seem to mean that my data is not a matrix, but it is... so something is missing.</p>
  
  <p>My data is defined as:</p>
  
  <pre><code>data = read.table("data.csv")
  trainSet = as.data.frame(data[,1:(ncol(data)-1)])
  </code></pre>
  
  <p>Where the last line is my label</p>
  
  <p>I am trying to define my model as:</p>
  
  <pre><code>svm.model &lt;- svm(type ~ ., data=trainSet, type='C-classification', kernel='polynomial',scale=FALSE)
  </code></pre>
  
  <p>This seems like it should be correct but I am having trouble finding other examples.</p>
  
  <p>Here is my code so far:</p>
  
  <pre><code># load libraries
  require(e1071)
  require(pracma)
  require(kernlab)
  options(warn=-1)
  
  # load dataset
  SVMtimes = 1
  KERNEL="polynomial"
  DEGREE = 2
  data = read.table("head.csv")
  results10foldAll=c()
  
  # Cross Fold for training and validation datasets
  for(timesRun in 1:SVMtimes) {
      cat("Running SVM = ",timesRun," result = ")
  
      trainSet = as.data.frame(data[,1:(ncol(data)-1)])
      trainClasses = as.factor(data[,ncol(data)])
      model = svm(trainSet, trainClasses, type="C-classification", 
                  kernel = KERNEL, degree = DEGREE, coef0=1, cost=1, 
                  cachesize = 10000, cross = 10)
      accAll = model$accuracies
      cat(mean(accAll), "/", sd(accAll),"\n")
  
      results10foldAll = rbind(results10foldAll, c(mean(accAll),sd(accAll)))
   }
  
  
  # create model
  
  svm.model &lt;- svm(type ~ ., data = trainSet, type='C-classification', kernel='polynomial',scale=FALSE)
  </code></pre>
  
  <p>An example of one of my samples would be:</p>
  
  <pre><code>10.135338 7.214543 5.758917 6.361316 0.000000 18.455875 14.082668  31
  </code></pre>