title: R: What does `rm(list=ls())` do?
body: <p>While looking at some R code written by someone else, I find near the top of the document <code>rm(list=ls())</code>.  I tried looking up what the <code>rm</code> function does and as far as I can tell it deletes specified variables from the workspace, so that if you had <code>x=3</code> somewhere, then after running <code>rm(x)</code> the variable <code>x</code> would behave as if it had never been assigned (so for instance would throw an error if you tried to print it).</p>
  
  <p>But then the rest of the code is strange if I have this right, because it seems to be removing the empty list.  So it's not doing anything at all, right?  Is there a reason to have this code here?</p>