title: Binding multiple csv files and performing a logistic regress on it
body: <p>I have 13000 CSV files in a folder and I want to read them as one file in R and then perform logistic regression on this file. Also, I need to make the fan column to a binary one ( for the fan values greater than zero, values should change to 1. I am trying to use the following code but it is not working.</p>
  <pre><code>library(&quot;data.table&quot;)
  library(dplyr) 
  
  files &lt;- list.files(&quot;E:/WSU/Research/NN/try&quot;, pattern=&quot;\\.csv$&quot;, full.names=TRUE)
  united &lt;- bind_rows(lapply(files, read))
  
  results &lt;- lapply(united,  function(x) {
    DT &lt;- fread(x, sep=&quot;,&quot;)
    set(DT, j=&quot;fan&quot;, value=as.numeric(DT[, fan] &gt; 0))
    result &lt;- glm(
      fan ~ T_ctrl + T_out + RH_out + T_stp_cool + T_stp_heat + Humidity,
      data=DT, family=binomial(link=&quot;logit&quot;)
    )
    return(result)
  }
  </code></pre>