On 2011-03-21 10:37, Savitri N Appana wrote:
Thank you for your suggestion Allan. I should have paid attention to
the posting instructions.
Pls find below the sample code from the ?splsda in the caret package.
Note: It used to work fine in R v2.8.1, but this error shows up now,
given that I've modified the code on how the splsda or predict.splsda
functions are called, i.e. as caret:::splsda and caret:::predict.splsda
b/c I am running R v2.12.1 now.
######## sample code below..
library(caret)
data(mdrr)
set.seed(1)
inTrain<- sample(seq(along = mdrrClass), 450)
nzv<- nearZeroVar(mdrrDescr)
filteredDescr<- mdrrDescr[, -nzv]
training<- filteredDescr[inTrain,]
test<- filteredDescr[-inTrain,]
trainMDRR<- mdrrClass[inTrain]
testMDRR<- mdrrClass[-inTrain]
preProcValues<- preProcess(training)
trainDescr<- predict(preProcValues, training)
testDescr<- predict(preProcValues, test)
splsFit<- caret:::splsda(trainDescr, trainMDRR,
K = 5, eta = .9,
probMethod = "Bayes")
splsFit### ERROR is HERE!!!!
Error in switch(classifier, logistic = { : EXPR must be a length 1
vector
<snip>
This message comes from print.splsda() in the spls package.
As the caret:::splsda help page indicates, caret's splsda()
uses the spls:::spls() function. So, although your splsFit
object has class "splsda", you should print it with
print.spls(splsdaFit)
Peter Ehlers
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.