title: What is the meaning of the dollar sign "$" in R function()?
body: <p>Through learning <code>R</code>, I just came across the following code explained <a href="https://cran.r-project.org/doc/manuals/R-intro.html#Scope" rel="noreferrer">here</a>. </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 + amount
        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")
      }
    )
  }
  
  ross &lt;- open.account(100)
  robert &lt;- open.account(200)
  
  ross$withdraw(30)
  ross$balance()
  robert$balance()
  
  ross$deposit(50)
  ross$balance()
  ross$withdraw(500)
  </code></pre>
  
  <p>What is the most of my interest about this code, learning the use of <code>"$"</code> dollar sign which refer to an specific <code>internal function</code> in  <code>open.account()</code> function. I mean this part :</p>
  
  <pre><code>    ross$withdraw(30)
      ross$balance()
      robert$balance()
  
      ross$deposit(50)
      ross$balance()
      ross$withdraw(500)
  </code></pre>
  
  <p><strong>Questions:</strong> <br></p>
  
  <p>1-  What is the meaning of the dollar sign <code>"$"</code> in <code>R</code> <code>function()</code> ? <br> 
  2-  How to <strong>identify</strong> its attributes in functions, specially for the functions that you adopting from other (<em>i.e.</em> you did not write it)?<br> 
  I used the following script </p>
  
  <pre><code>&gt; grep("$", open.account())
  [1] 1 2 3
  </code></pre>
  
  <p>but it is not useful I want to find a way to extract the name(s) of internal functions that can be refer by "$" without just by calling and searching the written code as  <code>&gt; open.account()</code> . <br>
    For instance in case of <code>open.account()</code> I'd like to see something like this:</p>
  
  <pre><code>$deposit
  $withdraw
  $balance
  </code></pre>
  
  <p>3- Is there any reference that I can read more about it? <br>
  tnx!</p>