title: R Dataframes : Arguments imply differing number of rows
body: <p>I have data of 11784 records split into test (2946) and train (8838) to run a h20 algorithm, but got an error related to the data frame that I'm trying to create as the final output to link the predictions and the ids that the predictions were made for. <br> </p>
  
  <p>Error for this line: <br>
  df_y_test &lt;- data.frame(ID = df_labels, Status = df_y_test$predict)</p>
  
  <p><strong>Error in data.frame(ID = df_labels, Status = df_y_test$predict) : 
    arguments imply differing number of rows: 2946, 2950</strong></p>
  
  <p>Looked through the forums and understood that the number of rows in df_y_test is 2950 which is causing this, but couldn't figure out why since df_y_test is also derived from the same 'test' variable overall which has only 2946 rows - would be happy for any guidance please, full script posted below for reference <br></p>
  
  <p>data : 11784 obs of 46 variables <br>
  test: 2946 obs of 45 variables <br>
  train: 8838 obs of 46 variables <br>
  df_labels: 2946 obs of 1 variable <br>
  df_y_test: 2950 obs of 4 variables <br></p>
  
  <pre><code># Load Data
  data &lt;- read.csv('Data.csv')
  
  # Partition Data 
  library(caTools)
  set.seed(75)
  split &lt;- sample.split(data$Status, SplitRatio = 0.75)
  train &lt;- subset(data, split == TRUE)
  test &lt;- subset(data, split == FALSE)
  
  # Dropping the column to be predicted from Test 
  test &lt;- subset(test[,-c(2)])
  
  library(readr)
  library(h2o)
  
  # Init h2o
  localh2o &lt;- h2o.init(max_mem_size = '2g', nthreads = -1)
  
  # convert status values (to be predicted) in second column to factors in h2o
  train[,2] &lt;- as.factor(train[,2])
  train_h2o &lt;- as.h2o(train)
  test_h2o &lt;- as.h2o(test)
  
  # Running H2O
  model &lt;- h2o.deeplearning(x=c(1, 3:46), 
                         y=2,
                         training_frame = train_h2o,
                         activation = "RectifierWithDropout", 
                         input_dropout_ratio = 0.2,
                         hidden_dropout_ratios = c(0.5, 0.5),
                         balance_classes = TRUE,
                         hidden = c(100,100),
                         nesterov_accelerated_gradient = T,
                         epochs = 15 ) 
  
  h2o_y_test &lt;- h2o.predict(model, test_h2o)
  
  # Converting to data frames from h2o
  df_y_test &lt;- as.data.frame(h2o_y_test)
  df_labels &lt;- as.data.frame(test[,1])
  df_y_test &lt;- data.frame(ID = df_labels, Status = df_y_test$predict)
  
  write.csv(df_y_test, file="predictionsH2o.csv", row.names = FALSE)
  
  h2o.shutdown(prompt = FALSE)
  </code></pre>