title: Automate Machine Learning process with R on multiple datasets
body: <p>I have multiple datasets with different lengths. I want to apply a correlation function to delete correlated variables with 98%. How can I use a loop to apply a correlation function on multiple datasets in the same time and store the variables selected in new dataframes?</p>
  <p>How can I also use lasso regression on multiple datasets, also using loop functions? Thank you</p>
  <pre><code>    H&lt;-data.frame(replicate(10,sample(0:20,10,rep=TRUE)))   
      C&lt;-data.frame(replicate(5,sample(0:100,10,rep=FALSE)))
      R&lt;-data.frame(replicate(7,sample(0:30,10,rep=TRUE)))
      E&lt;-data.frame(replicate(4,sample(0:40,10,rep=FALSE)))
  
  # Corrélation
      library(&quot;caret&quot;)
      library(&quot;dplyr&quot;)
      data.cor &lt;- cor(subset(H, select = -c(X10)))
      high.cor &lt;- findCorrelation(data.cor, cutoff=0.98)
      remove &lt;- names(H[high.cor]) 
      remove &lt;- c(remove)
  
      myvars &lt;- names(H) %in% remove
      var_selected &lt;- H[!myvars]
      new_data_H &lt;- var_selected
  </code></pre>