title: How to remove selected R variables without having to type their names
body: <p>While testing a simulation in R using randomly generated input data, I have found and fixed a few bugs and would now like to re-run the simulation with the same data, <em>but with all intermediate variables removed to ensure it's a clean test</em>.</p>
  
  <p><strong>Is there a way to remove several dozen manually selected variables from the workspace without having to:</strong>
  a) clobber the entire workspace, e.g. <code>rm(list=ls())</code>, or b) type each variable name, e.g. <code>remove(name1, name2, ...)</code>?</p>
  
  <p>Ideal solution would be to use <code>ls()</code> to inspect the definitions and then pick out the indices of the ones I want to remove, e.g.</p>
  
  <pre><code>ls()                        # inspect definitions
  delme &lt;- c(3,5,7:9,11,13)   # names selected for removal
  remove(ls()[delme])         # DESIRED SOLUTION -- doesn't quite work this way
  </code></pre>
  
  <p>(In hindsight, I should have used a fixed seed to generate the random input data, which allow clearing everything and then re-running the test...)</p>