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"
#-----------------------------------------------------------
alldata<-read.csv(ifname,row.names=1,header=T,as.is=TRUE)
#[1]-Assessment of training data ---------------------------------------
results.ksv<-train(Species~.,
                  data=alldata,
                  method='svmRadial',
                  trControl=trainControl(method="LOOCV")
                  )
names(results.ksv)
results.ksv
results.ksv$finalModel
confusionMatrix(data=predict(results.ksv,alldata),as.factor(alldata$Species))
#[2] save results----------------------------------
predData<-predict(results.ksv,alldata)
Fdata<-data.frame(alldata[,5],predData)
colnames(Fdata)<-c("Org","KSV")
write.csv(Fdata,file="PredKSV.csv")