Creating dataframe in R loop and naming it
<p>I am working with 5 data frames that I want to filter (eliminating some rows if they match a regex). Because all data frames are similar, with the same variable names, I stored them in a list and I'm iterating it. However, when I want to save the filtered data for each of the original data frame, I find that it creates an i_filtered (instead of dfName_filtered) so every time the loop runs, it gets overwritten. 
Here's what I have in the loop:</p>

<pre><code>for (i in list_all){
  i_filtered1 &lt;- i[i$chr != filter1,]
  i_filtered2 &lt;- i[i$chr != filter2,]
  #Write the result filtered table in a csv file
  #Change output directory if needed
  write.csv(i_filtered2, file="/home/tama/Desktop/i_filtered.csv")
}
</code></pre>

<p>As I said, filter1 and filter2 are just regex that I'm using to filter the data in the chr column.
What's the correct way to assign the original name + "_filtered" to the new dataframe?</p>

<p>Thanks in advance</p>

<p>Edited to add info:
Each dataframe has these variables (but values can change)</p>

<pre><code>chr     start   end    length
chr1    10400   10669   270
chr10   237646  237836  191
chrX    713884  714414  531
chrUn   713884  714414  531
chr1    762664  763174  511
chr4    805008  805571  564
</code></pre>

<p>And I have stored all them in a list:</p>

<pre><code>list_all &lt;- list(heep, oe, st20_n, st20_t,all)
list_all &lt;- lapply(list_all, na.omit)
</code></pre>

<p>The filters:</p>

<pre><code>#Get rid of random chromosomes
filter1=".*random"
#Get rid of undefined chromosomes
filter2 = "ĉhrUn.*
</code></pre>

<p>The output I'm looking for is:</p>

<pre><code>heep_filtered1
heep_filtered2
oe_filtered1
oe_filtered2
etc
</code></pre>