title: Why is using assign bad?
body: <p>This post (<a href="https://stackoverflow.com/questions/14884343/lazy-evaluation-in-r-is-assign-affected">Lazy evaluation in R – is assign affected?</a>) covers some common ground but I am not sure it answers my question.</p>
  
  <p>I stopped using <code>assign</code> when I discovered the <code>apply</code> family quite a while back, albeit, purely for reasons of elegance in situations such as this:</p>
  
  <pre><code>names.foo &lt;- letters
  values.foo &lt;- LETTERS
  for (i in 1:length(names.foo))
    assign(names.foo[i], paste("This is: ", values.foo[i]))
  </code></pre>
  
  <p>which can be replaced by:</p>
  
  <pre><code>foo &lt;- lapply(X=values.foo, FUN=function (k) paste("This is :", k))
  names(foo) &lt;- names.foo
  </code></pre>
  
  <p>This is also the reason this (<a href="http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-turn-a-string-into-a-variable_003f" rel="noreferrer">http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-turn-a-string-into-a-variable_003f</a>) R-faq says this should be avoided.</p>
  
  <p>Now, I know that <code>assign</code> is generally frowned upon. But are there other reasons I don't know? I suspect it may mess with the scoping or lazy evaluation but I am not sure? Example code that demonstrates such problems will be great.</p>