svm - How to not hardcode the values in the model in R -
in r svm model, how can change predicted variable not being hardcoded in model itself, rather variable name can have different value.
svmmodel <- svm(sr~., data = dataset)
here how can change sr~. variable can have sr or someother value needs predicted
you can build formuals dynamically in different ways. 1 way use bquote()
insert symbol formula. example
resp<-quote(sr) bquote(.(resp)~.) # sr ~ .
or can build formula string
resp<-"sr" dep<-"." as.formula(paste(resp,dep,sep="~")) # sr ~ .
Comments
Post a Comment