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.rf<-train(Species~.,
                  data=alldata,
                  method='rf',
                  trControl=trainControl(method="LOOCV")
                  )
#[2]-Analysis---------------------------------
names(results.rf)
results.rf
confusionMatrix(data=predict(results.rf,alldata),as.factor(alldata$Species))
results.rf$finalModel
#[3]-save results------
predData<-predict(results.rf,alldata)
Fdata<-data.frame(alldata[,5],predData)
colnames(Fdata)<-c("Org","RMF")
write.csv(Fdata,file="PredRMF.csv")