2

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

raccoonjin
  • 217
  • 1
  • 5
  • 12

3 Answers3

7

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

raccoonjin
  • 217
  • 1
  • 5
  • 12
4

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

require(caret)

Michael
  • 196
  • 2
  • 5
1

This worked for me:

install.packages('e1071')

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

PipplerNO4
  • 11
  • 1