This may not always be useful when we venture too far from the cosy
world of lm().
For example I have just been looking at the function flexmixedruns()
from package fpc, and the object fr that is its value in the examples
for that function.
> methods(class=class(fr))
just produces the standard list methods because fr is defined as a list.
To get stuff out you need $.
Still I like Gabor's suggestion and I will use it when a function
returns an object of an unusual class.
Murray
On 25/09/2010 11:07 a.m., Gabor Grothendieck wrote:
On Fri, Sep 24, 2010 at 6:25 PM, Murray Jorgensen <[email protected]
<mailto:[email protected]>> wrote:
When will I ever learn to proof-read my emails?!
=============
I think what Greg sayS here is the "official wisdom" and it leads to
more future-proofED code as the structure of various objects can
change in new versions of R.
OTOH the structure of a kind of object can always be explored with
str(), but it may not be easy to find out what extractor functions
are available for the object.
Try this using builtin data.frame, BOD, to find methods can be applied
to fm:
fm <- lm(demand ~ Time, BOD)
methods(class = class(fm))
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com <http://gmail.com>
--
Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html
Department of Statistics, University of Waikato, Hamilton, New Zealand
Email: [email protected] [email protected] Fax 7 838 4155
Phone +64 7 838 4773 wk Home +64 7 825 0441 Mobile 021 0200 8350
_______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-teaching