I am trying to run the GBM code in R :
gbmModel = gbm(formula = formula_gbm,
               distribution = "bernoulli",
               data = dev_new,
               n.trees = 200,
               interaction.depth = 6,
               train.fraction=0.6,
               bag.fraction = 0.6, 
               shrinkage = 0.4, 
               cv.folds=1,
               verbose = TRUE)  
When I try with cv.folds=0, it runs perfectly- as soon as I am using cv.folds>0, I am facing the below error. Any idea why this might be happening? Thanks in advance!
Iter   TrainDeviance   ValidDeviance   StepSize   Improve
     1        0.1165          0.1206     0.4000   -0.0037
     2        0.1977          0.2197     0.4000   -0.0484
     3        0.2706          0.2493     0.4000   -0.0606
     4        0.2705          0.2556     0.4000   -0.0047
     5        0.2691          0.2559     0.4000    0.0004
     6        0.2954             inf     0.4000   -0.0395
     7        0.2786             inf     0.4000    0.0076
     8        0.2790             inf     0.4000   -0.0010
     9        0.2694             inf     0.4000    0.0027
    10        0.2694             inf     0.4000   -0.0006
*Error in gbm(formula = formula_gbm, distribution = "bernoulli", data = dev_new,  : 
  object 'p' not found*
