title: Understanding element wise clearing of R's workspace
body: <p>I am trying to find a way to clear the workspace in R using lists.</p>
  
  <p>According to the documentation, I could simply create a vector with all my workspace objects: <code>WS=c(ls())</code>. But nothing happens when I try element wise deletion with <code>rm(c(ls())</code> or <code>rm(WS)</code>.</p>
  
  <p>I know I can use the command <code>rm(list=ls())</code>. I am just trying to figure how R works. Where did I err in my thinking in applying the <code>rm()</code> function on a vector with the list of the objects?</p>
  
  <hr>
  
  <p>Specifically, I'm trying to create a function similar to the <code>clc</code> function in MATLAB, but I am having trouble getting it to work. Here's the function that I've written:</p>
  
  <pre><code>clc &lt;- function() { rm(list = ls()) }
  </code></pre>