title: how to output a list with invisible items R while showing only part of the list
body: <p>I guess this question has been asked somewhere. Although I cannot find one. Please help me out. I need to output a list but only show maybe the first element of the list while the other elements are invisible. Though one is able to access them.</p>
  
  <p>Allow me to give an example.</p>
  
  <pre><code> s=lm(iris)
   s
  
   Call:
   lm(formula = iris)
  
   Coefficients:
         (Intercept)        Sepal.Width       Petal.Length        Petal.Width  
              2.1713             0.4959             0.8292            -0.3152  
   Speciesversicolor   Speciesvirginica  
             -0.7236            -1.0235  
  
   length(s)
   [1] 13
  </code></pre>
  
  <p>Here We see that when using <code>lm</code> function, the output is a list of length 13. We can access all the elements we want from <code>s</code> by simply using the dollar sign. But at the same time we only see call and the coefficients, we do not see all the other elements like the residuals, fitted values etc. How can I implement this on my function? </p>
  
  <p>For the example above, The object returned is of class lm. I would like to write a function not necessarily outputting an lm object. </p>
  
  <p>Thank you</p>