1

I cannot thrive to train a model with the caret package without errors.

Here is a minimum reproductible data set: Dataset

And here is the code I'm using...

data <- read.csv('file.csv', header = TRUE, sep = ',')

library(caret)
data <- data[complete.cases(data), ]
data$donation <- as.factor(data$donation)

set.seed(1337)
ctrl <- trainControl(
  method="repeatedcv",
  number="10",
  repeats=10)

data <- data[,-2]
nnet.fit <- train(donation ~ ., data = data,
                  method = "nnet",
                  trControl = ctrl,
                  verbose = FALSE,
                  tuneLength = 5)

...that leads to this error:

Error in numInClass[i]%/%k : non-numeric argument to binary operator

I have checked this answer but didn't understand how to solve my problem with it.

Any clue ?

Community
  • 1
  • 1
Synleb
  • 143
  • 2
  • 2
  • 13

1 Answers1

1

Just seen this while trying to find a solution on the same. It's a very simple answer bro: ctrl <- trainControl( method="repeatedcv", number="10",# Here the 10 should not be wrapped in quotation marks as its numeric repeats=10)

bill
  • 21
  • 2