x <- c('e1071','caret');for(i in x){if(!require(i,character.only=T)){
  install.packages(i,dependencies=T);library(i,character.only=T)}};rm(x,i)
#--------------------------------------------------------------------
ifname<-"irisAll.csv"
#[1]-----------------------------------------------------------
alldata<-read.csv(ifname,row.names=1,header=T,as.is=TRUE)
#[2]-Assessment of training data ---------------------------------------
results.qda<-train(Species~.,
                  data=alldata,
                  method='qda',
                  #trControl=trainControl(method="boot",number=10)
                  #trControl=trainControl(method="cv",number=10)
                  #trControl=trainControl(method="repeatedcv",number=10,repeats=5)
                  trControl=trainControl(method="LOOCV")
                  )
confusionMatrix(data=predict(results.qda,alldata),as.factor(alldata$Species))
#--- OUTPUT --------------------------
predData<-predict(results.qda,alldata)
Fdata<-data.frame(alldata[,5],predData)
colnames(Fdata)<-c("Org","Qda")
write.csv(Fdata,file="PredQDA.csv")