raccoonjin
raccoonjin

Reputation: 217

no applicable method for 'train' applied to an object of class "data.frame"

I'm following the book 'R deep learning essentials:by Dr.Joshua' In ch2, 22page , there's a code following

set.seed(1234)
digits.m1 <- train(digits.X, digits.y,
       method = "nnet",
       tuneGrid = expand.grid(
         .size = c(5),
         .decay = 0.1),
       trControl = trainControl(method = "none"),
       MaxNWts = 10000,
       maxit = 100)

And I met the ERROR : Error in UseMethod("train") : no applicable method for 'train' applied to an object of class "data.frame"

I'm using R 3.3.2, window7

Upvotes: 2

Views: 7320

Answers (3)

PipplerNO4
PipplerNO4

Reputation: 11

This worked for me:

install.packages('e1071')

I guess Caret requires the package but does not always automatically download it.

Upvotes: 1

Michael
Michael

Reputation: 326

If you don't wish to use the prefix "caret::", then add this line of code above it:

require(caret)

Upvotes: 4

raccoonjin
raccoonjin

Reputation: 217

'caret::train' is working. Maybe it was masked

Upvotes: 7

Related Questions