title: Replacement command loop in R command
body: <p>I have a list consisting of 12 dataframes, and want to write a loop in R instead of using brute force to replace variables in each dataframe.</p>
  <p>The dataframes are named after months -</p>
  <p><code>jan feb mar april may june july ug sep oct nov dec</code></p>
  <p>Currently I use brute force to convert dashes or blanks to &quot;NA&quot; values in each dataframe.</p>
  <pre><code>##jan
  cleanest_data_2009$wireless_data_jan_09[cleanest_data_2009$wireless_data_jan_09==&quot;-&quot;]=NA #replaces columns with pure &quot;-&quot; entries with a NA
  
  ##feb
  cleanest_data_2009$wireless_data_feb_09[cleanest_data_2009$wireless_data_feb_09==&quot;-&quot;]=NA #replaces columns with pure &quot;-&quot; entries with a NA
  .
  .
  .
  
  ##dec
  </code></pre>
  <p>I want to write a loop for this process - I think the one I write reads it the command as a text and not as a command.</p>
  <pre><code>my_months &lt;- c(&quot;jan&quot; , &quot;feb&quot;, &quot;mar&quot; , &quot;april&quot; , &quot;may&quot; , &quot;june&quot; , &quot;july&quot; , &quot;aug&quot; , &quot;sep&quot; , &quot;oct&quot; , &quot;nov&quot; , &quot;dec&quot;)
  
  for (month in my_months){
    print(paste(&quot;The month is&quot;, month))
    cleanest_data_2009$wireless_data_month_09[cleanest_data_2009$wireless_data_month_09==&quot;-&quot;]=NA #replaces columns with pure &quot;-&quot; entries with a NA
   }
  </code></pre>