Train(): argument "x" is missing, with no default


#1

library(e1071)
Warning message:
package ‘e1071’ was built under R version 3.4.4
library(caret)
Loading required package: lattice
Loading required package: ggplot2
Warning messages:
1: package ‘caret’ was built under R version 3.4.4
2: package ‘ggplot2’ was built under R version 3.4.4
svm.data <- read.csv(file.choose(), header=TRUE) # undersample dataset
str(svm.data)
'data.frame': 2538 obs. of 5 variables:
X : int 1 2 3 4 5 6 7 8 9 10 ... SessionID: int 13307 21076 27813 8398 23118 12256 28799 11457 7542 19261 ...
Timestamp: Factor w/ 2532 levels "2014-04-01T03:02:33.088Z",..: 2064 905 1086 1027 2419 1327 2035 1206 481 1354 ... ItemID : int 214684513 214718203 214716928 214826900 214838180 214717318 214821307 214537967 214835775 214706432 ...
$ Price : int 0 0 0 0 0 0 0 0 0 0 ...
dim(svm.data)
[1] 2538 5
summary(svm.data)
X SessionID Timestamp ItemID Price
Min. : 1.0 Min. : 11 2014-04-05T16:43:50.136Z: 2 Min. :214508287 Min. :0.0000
1st Qu.: 635.2 1st Qu.: 4230 2014-04-05T17:50:02.668Z: 2 1st Qu.:214664919 1st Qu.:0.0000
Median :1269.5 Median : 8794 2014-04-06T08:15:26.952Z: 2 Median :214744775 Median :0.0000
Mean :1269.5 Mean :10989 2014-04-06T18:24:51.207Z: 2 Mean :214899932 Mean :0.4921
3rd Qu.:1903.8 3rd Qu.:15902 2014-04-07T13:42:52.377Z: 2 3rd Qu.:214826702 3rd Qu.:1.0000
Max. :2538.0 Max. :32764 2014-04-07T23:23:55.273Z: 2 Max. :643078783 Max. :1.0000
(Other) :2526
x <- subset(svm.data, select=-Price)
y <- svm.data$Price
table(svm.data$Price)

0 1
1289 1249

table(svm.data$Price) / length(svm.data$Price)

    0         1 

0.5078802 0.4921198

set.seed(123)
ctrl1 <- trainControl(method="cv", number = 2, summaryFunction=twoClassSummary, classProbs=TRUE)
grid <- expand.grid(sigma = c(.01, .015, 0.2), C = c(0.75, 0.9, 1, 1.1, 1.25))
svm.tune <- train(train.x=x, train.y=y, method = "svmRadial", metric="ROC", tuneGrid = grid, trControl=ctrl1)
Error in is.data.frame(x) : argument "x" is missing, with no default. how to solve this error :frowning: