title: I get an error when setting the arguments of this function to determine size of objects in memory
body: <p>Starting from <a href="https://stackoverflow.com/a/4827843/1711271">this nice response</a>, in turn based on code from <a href="https://stackoverflow.com/questions/1358003/tricks-to-manage-the-available-memory-in-an-r-session">this question</a>, I wrote the following function to get the size of objects in memory:</p>
  
  <pre><code># improved list of objects
  .ls.objects &lt;- function (pos = 1, pattern, order.by,
                          decreasing=FALSE, head=FALSE, n=5) {
      napply &lt;- function(names, fn) sapply(names, function(x)
                                           fn(get(x, pos = pos)))
      names &lt;- ls(pos = pos, pattern = pattern)
      obj.class &lt;- napply(names, function(x) class(x)[1])
      obj.mode &lt;- napply(names, mode)
      obj.type &lt;- ifelse(is.na(obj.class), obj.mode, obj.class)
      obj.prettysize &lt;- napply(names, function(x) {
                             format(utils::object.size(x), units = "auto") })
      obj.size &lt;- napply(names, object.size)
      obj.dim &lt;- t(napply(names, function(x)
                          as.numeric(dim(x))[1:2]))
      vec &lt;- is.na(obj.dim)[, 1] &amp; (obj.type != "function")
      obj.dim[vec, 1] &lt;- napply(names, length)[vec]
      out &lt;- data.frame(obj.type, obj.size, obj.prettysize, obj.dim)
      names(out) &lt;- c("Type", "Size", "PrettySize", "Length/Rows", "Columns")
      if (!missing(order.by))
          out &lt;- out[order(out[[order.by]], decreasing=decreasing), ]
      if (head)
          out &lt;- head(out, n)
      out
  }
  
  # shorthand
  lsos &lt;- function(..., n=10) {
      .ls.objects(..., order.by="Size", decreasing=TRUE, head=TRUE, n=n)
  }
  </code></pre>
  
  <p>However, when I try to call <code>lsos</code> with arguments, in order to display <em>all</em> objects in memory and not just the first <code>n</code>, I get the following error:</p>
  
  <pre><code>&gt; lsos(head = FALSE)
  Error in .ls.objects(..., order.by = "Size", decreasing = TRUE, head = TRUE,  : 
    formal argument "head" matched by multiple actual arguments
  </code></pre>
  
  <p>What's happening? </p>