title: R- Xgboost: Error in xgb.DMatrix unused argument
body: <p>This is my first question here so I'm sorry if I'm not clear.</p>
  <p>I was building an Xgboost model to forecast multiple time series. I've created the train and test xgb.DMatrix, also the xgb_trcontrol and xgb_grid tunning parameters, nevertheless when I try to build the model I get an error message like this:</p>
  <blockquote>
  <p>Error in <code>[.xgb.DMatrix</code>(x, 0, , drop = FALSE) :    unused argument
  (drop = FALSE)</p>
  </blockquote>
  <p>Also, all the columns in the train and test matrix are numeric.
  Please find the code below:</p>
  <pre><code>    xgb_train &lt;- base_proyecto[1:split_factor,]
      xgb_test &lt;- base_proyecto[(split_factor+1):132,]
      #Transform train and test data to DMatrix form
      train_Dmatrix &lt;- xgb_train %&gt;% #Here I've ommited date, and target variable
        dplyr::select(-c(1,10)) %&gt;% mutate(year=as.numeric(year),month=as.numeric(month)) %&gt;% 
        as.matrix() %&gt;% 
        xgb.DMatrix()
      
      pred_Dmatrix &lt;- xgb_test %&gt;%  #Here I've ommited date, and target variable
        dplyr::select(-c(1,10)) %&gt;% mutate(year=as.numeric(year),month=as.numeric(month)) %&gt;% 
        as.matrix() %&gt;% 
        xgb.DMatrix()
      
      targets &lt;- xgb_train$credito_total
      
      #Cross-validation
      xgb_trcontrol &lt;- trainControl(
        method = &quot;cv&quot;, 
        number = 5,
        allowParallel = TRUE, 
        verboseIter = FALSE, 
        returnData = FALSE
      )
      
      #Building parameters set
      xgb_grid &lt;- base::expand.grid(
        list(
          nrounds = c(100,200),
          max_depth = c(10,15,20), 
          colsample_bytree = seq(0.5), 
          eta = 0.1,
          gamma = 0,
          min_child_weight = 1,  
          subsample = 1)
      )
      #Building the model (The error message pops up here)
      model_xgb &lt;- train(
        train_Dmatrix,targets,
        trControl = xgb_trcontrol,
        tuneGrid = xgb_grid,
        method = &quot;xgbTree&quot;,
        nthread = 1
      )
  </code></pre>
  <p>PD: My data looks like this</p>
  <pre><code>&gt; head(base_proyecto)
    credito_total  google_q1 google_q2 google_q3  google_q4 inflacion tasa_activa tasa_pasiva precio_wti      fecha
  1     -2.390521 -1.2273561 -2.056537  -1.11448 -1.2664245 0.2832895   1.3848000  -1.4575066  0.5764112 2010-10-01
  2     -2.027531 -1.2273561 -2.056537  -1.11448 -1.2664245 0.3342099   1.3848000  -1.4575066  0.6711702 2010-11-01
  3     -2.121730 -1.2273561 -2.056537  -1.11448 -1.2664245 1.0908061   0.8240173  -1.4904277  0.8905438 2010-12-01
  4     -1.834393 -1.0333890 -1.337906  -1.11448 -1.2664245 1.6026221   0.6299002  -1.0459930  0.9052552 2011-01-01
  5     -1.280232 -0.5484713 -1.158248  -1.11448  0.4406159 1.2168620  -0.1034311  -1.1118351  0.9013610 2011-02-01
  6     -1.131422 -1.0333890  0.997645  -1.11448 -0.7786986 0.5394940   0.7593116  -0.9801508  1.4893860 2011-03-01
    year yday month
  1 2010  274    10
  2 2010  305    11
  3 2010  335    12
  4 2011    1     1
  5 2011   32     2
  6 2011   60     3
  </code></pre>
  <p>Any suggestions on how to fix this are welcome?</p>