[R] contrasts can be applied only to factors with 2 or more levels
javed khan
j@vedbtk111 @end|ng |rom gm@||@com
Fri Dec 20 20:53:10 CET 2019
I am using the folowing code and it give me the error message like
" contrasts can be applied only to factors with 2 or more levels".
What could be the problem
d=read.csv("Result.csv")
index <- createDataPartition(log10(d$Results), p = .70,list = FALSE)
tr <- d[index, ]
ts <- d[-index, ]
index_2 <- createFolds(log10(tr$Results), returnTrain = TRUE, list = TRUE)
ctrl <- trainControl(method = "cv", index = index_2)
set.seed(30218)
grid_search <- train(log10(Results) ~ ., data = tr,
method = "svmRadial",
tuneLength = 8,
metric = "MAE",
preProc = c("center", "scale", "zv"),
trControl = ctrl)
[[alternative HTML version deleted]]
More information about the R-help
mailing list