How to display argument value of list object created by a function
<p>I have a function open.account which takes an argument 'total' and creates a list of three functions (deposit, withdraw, balance).  If I run <code>test &lt;- open.account(100)</code> how can I access the value of total for test directly without calling one of the list functions?</p>

<pre><code>    open.account &lt;- function(total) {
  list(
    deposit = function(amount) {
      if(amount &lt;= 0)
        stop("Deposits must be positive!\n")
      total &lt;&lt;- total + amountw
      cat(amount, "deposited.  Your balance is", total, "\n\n")
    },
    withdraw = function(amount) {
      if(amount &gt; total)
        stop("You don't have that much money!\n")
      total &lt;&lt;- total - amount
      cat(amount, "withdrawn.  Your balance is", total, "\n\n")
    },
    balance = function() {
      cat("Your balance is", total, "\n\n")
    }
  )
}
</code></pre>