Working with Columns in a List of DataFrames in R
<p>I have a list of dataframes called <strong>Lista_DF</strong>, some DF on this list have a column called <strong>COD_MOEDA</strong>.</p>

<p>I am trying to substitute all 0 values for "BRL" on the DF's that have a column named <strong>COD_MOEDA</strong>, and iam using :</p>

<pre><code>Lista_DF &lt;- lapply(Lista_DF,function(x) 
{
   x$COD_MOEDA[x$COD_MOEDA == 0] &lt;- 'BRL'
})
</code></pre>

<p>But i am getting this error :</p>

<pre><code>Error in `$&lt;-.data.frame`(`*tmp*`, "COD_MOEDA", value = character(0)) : 
replacement has 0 rows, data has 3094
</code></pre>

<p>I believe it is due to the DF that don't have the column named <strong>COD_MOEDA</strong></p>

<p>Any suggestions ?</p>

<p>This is a continuation of <a href="https://stackoverflow.com/questions/36484936/changing-values-on-the-same-column-for-different-dataframes-in-r">Changing Values on the Same Column for Different DataFrames (in R)</a></p>