0

I am running into an issue with this very simple line of code and cannot understand why this formal argument error is occurring. Hoping someone may be able to clarify? I am brand new and really trying to learn each step!

model <- ksvm(as.matrix(data[,1:10]),as.factor(data[,11]),type="C-svc",kernel="vanilladot",c=100,sCALED=TRUE)

Error in .local(x, ...) : argument 5 matches multiple formal arguments

Maurits Evers
  • 49,617
  • 4
  • 47
  • 68
  • R is case-sensitive; the argument you should be `C=100` (`C` is the cost of constraints violation). The error stems from R trying to partially match the argument `c` to all allowed `ksvm` function arguments and finding multiple matches. A similar argument applies to `sCALED` which should be `scaled=TRUE`. – Maurits Evers Jan 15 '20 at 02:48
  • PS. I have also changed your title to be more meaningful. For future posts I recommend reviewing [how to ask good questions](https://stackoverflow.com/help/how-to-ask) and how to provide a [minimal reproducible example/attempt](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – Maurits Evers Jan 15 '20 at 02:54
  • Wow! Thank you so much! This is very helpful for future things for me to keep in mind. I did update and now the error has changed, which lets me know I'm on the right track. Currently trying to understand cause of error "Error: Must use a vector in `[`, not an object of class matrix." in case you may have any thoughts! – LearningSC Jan 15 '20 at 02:55
  • Happy to help if you provide some minimal & representative sample data; that will give us something to work with. Take a look at the links I give in my previous PS comment on how to provide data (using e.g. `dput`). – Maurits Evers Jan 15 '20 at 02:57

0 Answers0