I am using this code:
    mtry <- round(sqrt(18), 0)
gbmGrid <- expand.grid(
              interaction.depth = c(1, 2, 3, 4, 5, 6)
            , n.trees = seq(10, 10000, by = 100)
            , shrinkage = 0.01
            , n.minobsinnode = c(5, 10, 20, 30)
            , distribution = 'gaussian'
            , method = 'gbm'
            , mtry = mtry
    )
    fitControl <- trainControl(
                method = "repeatedcv"
                , number = 2
                , repeats = 3
        )
    gbmFit1 <- train(
                     Y ~
                      X1
                    + X2
                    , data = Train
                    , trControl = fitControl
                    , tuneGrid = gbmGrid
                    , verbose = FALSE
        )
but get:
The tuning parameter grid should have columns mtry
I installed the latest package as some people suggested this and also tried using .mtry. Any ideas? (yes I googled and had a look at SO)
 
    