I am trying to get a plot similar to the one obtained in this post Plot SVM linear model trained by caret package in R
This code works if I run it on my console, but if I do it with my data it does not work, so I am wondering if it is a problem of my data. Here it is the example that does not work for me:
library(wakefield)
X <- r_sample_factor(c("low", "high"), n=232)
MAMAMA<-r_sample_factor(c("C/C", "C/G", "G/G"), n=232)
MEMEME<-r_sample_factor(c("C/C", "C/T", "T/T"), n=232)
MIMIMI<-r_sample_factor(c("A/A", "A/T", "T/T"), n=232)
datos<-data.frame(X,MAMAMA,MEMEME, MIMIMI)
sv<-caret::train(X~., datos, method="svmRadial", trControl= trainControl(method='cv', number=5))
kernlab::plot(sv$finalModel)