title: Print environment using R
body: <p>I'd like to write a function whose the output be an object of the class <code>myclass</code> with vector, list, integer an so on. Similarly to <code>lm</code>function. I tried to use an <code>environment</code>, but when I printed the function value the result is </p>
  
  <pre><code>#Term 1
  &gt; fit1
  &lt;environment: 0x00000000220d1998&gt;
  attr(,"class")
  [1] "myclass"
  </code></pre>
  
  <p>However, when I print the <code>lm</code> function, the result is</p>
  
  <pre><code>&gt; fit2
  Call:
  lm(formula = variable1 ~ variable2)
  
  Coefficients:
       (Intercept)         variable2  
           49.0802            0.3603 
  </code></pre>
  
  <p>I know to access the individual values of the <code>environment</code> using <code>$</code>. But I'd like that the object was printed equal to <code>lm</code> function as showed.</p>