title: Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : NA/NaN/Inf in 'y', tried every possible way
body: <p>Here my dataset is <code>pd</code> and i have split it into training and testing data as <code>pd_train1</code> and <code>pd_train2</code></p>
  
  <pre><code>    sku national_inv lead_time in_transit_qty forecast_3_month forecast_6_month
  1 3921548            8        12              0                0                0
  2 3191009           83         2             33              157              377
  3 2935810            8         4              0                0                0
  4 2205847           31         4             63               70              160
  5 4953497            3        12              0                0                0
  6 2286884            0         8              0                0                0
    forecast_9_month sales_1_month sales_3_month sales_6_month sales_9_month min_bank
  1                0             1             1             2             5        2
  2              603            44            98           148           156       53
  3                0             0             0             1             1        0
  4              223            27            90           164           219        0
  5                0             0             0             0             0        0
  6                0             0             0             0             0        0
    potential_issue pieces_past_due perf_6_month_avg perf_12_month_avg local_bo_qty
  1               0               0             0.63              0.75            0
  2               0               0             0.68              0.66            0
  3               0               0             0.73              0.78            0
  4               0               0             0.73              0.78            0
  5               0               0             0.81              0.74            0
  6               0               0             0.91              0.96            0
    deck_risk oe_constraint ppap_risk stop_auto_buy rev_stop went_on_backorder  data
  1         0             0         0             1        0                No train
  2         0             0         0             1        0                No train
  3         0             0         0             1        0                No train
  4         0             0         1             1        0                No train
  5         0             0         0             1        0                No train
  6         0             0         0             1        0                No train
  </code></pre>
  
  <p>I wanted to create a lm model for my training data <code>pd_train1</code>
  But i am getting this error as below:</p>
  
  <pre><code>&gt; fit=lm(went_on_backorder~.,data=pd_train1)
  Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 
    NA/NaN/Inf in 'y'
  In addition: Warning message:
  In storage.mode(v) &lt;- "double" : NAs introduced by coercion
  </code></pre>
  
  <p>I tried searching for infinite values:</p>
  
  <pre><code>sapply(pd_train1, function(x) sum(is.infinite(x)))
               sku      national_inv         lead_time    in_transit_qty  forecast_3_month 
                  0                 0                 0                 0                 0 
   forecast_6_month  forecast_9_month     sales_1_month     sales_3_month     sales_6_month 
                  0                 0                 0                 0                 0 
      sales_9_month          min_bank   potential_issue   pieces_past_due  perf_6_month_avg 
                  0                 0                 0                 0                 0 
  perf_12_month_avg      local_bo_qty         deck_risk     oe_constraint         ppap_risk 
                  0                 0                 0                 0                 0 
      stop_auto_buy          rev_stop went_on_backorder              data 
                  0                 0                 0                 0 
  </code></pre>
  
  <p>And also for NA/NaN values in my training data on which i want to make linear model</p>
  
  <pre><code>     sku      national_inv         lead_time    in_transit_qty  forecast_3_month 
                  0                 0                 0                 0                 0 
   forecast_6_month  forecast_9_month     sales_1_month     sales_3_month     sales_6_month 
                  0                 0                 0                 0                 0 
      sales_9_month          min_bank   potential_issue   pieces_past_due  perf_6_month_avg 
                  0                 0                 0                 0                 0 
  perf_12_month_avg      local_bo_qty         deck_risk     oe_constraint         ppap_risk 
                  0                 0                 0                 0                 0 
      stop_auto_buy          rev_stop went_on_backorder 
                  0                 0                 0 
  
  
  Inf %in% pd_train1$went_on_backorder
  1] FALSE
  
  NaN %in% pd_test$went_on_backorder
  1] FALSE
  </code></pre>
  
  <p>Henceforth I am not able to get the NA/NaN/Inf values in my dataset
  Can someone help me understand why is this throwing an error, please?
  Here <code>went_on_backorder</code> is my target variable.</p>