title: What does the function invisible() do?
body: <p>R help explains <code>invisible()</code> as "a function that returns a temporarily invisible copy of an object". I have difficulty understanding what <code>invisible()</code> is used for. Would you be able to explain what <code>invisible()</code> does and when this function can be useful?</p>
  
  <p>I've seen that <code>invisible()</code> is almost always used in method functions for the <code>print()</code>. Here is one example:</p>
  
  <pre><code>### My Method function:
  print.myPrint &lt;- function(x, ...){
    print(unlist(x[1:2]))
    invisible(x)
  }
  
  x = list(v1 = c(1:5), v2 = c(-1:-5) )
  class(x) = "myPrint"
  print(x)
  </code></pre>
  
  <p>I was thinking that without <code>invisible(x)</code>, I wouldn't be able to do assignment like:</p>
  
  <pre><code>a = print(x)
  </code></pre>
  
  <p>But it's actually not the case.
  So, I'd like to know what <code>invisible()</code> does, where it can be useful, and finally what it's role is in the method print function above?</p>
  
  <p>Thank you very much for your help.</p>