[R] ipred: possible to use svm in errorest?

Daniel Stahl daniel_stahl at operamail.com
Tue Jun 21 13:56:33 CEST 2011


Dear all,


is it possible to run the support vector machine command "svm" from the
package e1071 within the errorest function from the library ipred?
It works fine for lda and rda but I get an error message (see below)

Thank you for your help.
Best wsihes, Daneil


# Classification

data(iris)

# force predict to return class labels only
mypredict.lda <- function(object, newdata)
predict(object, newdata = newdata)$class

> # 10-fold cv of LDA for Iris data
> errorest(Species ~ ., data=iris, model=svm, estimator = "cv", predict=  
> mypredict.lda)
Error in predict(object, newdata = newdata)$class :
    $ operator is invalid for atomic vectors

 

--



More information about the R-help mailing list