On 30/10/2008, at 11:48 AM, Juliet Hannah wrote:
Here is an example given from
?yags
library(methods)
data(stackloss)
Y1 <- yags(stack.loss~Air.Flow,id=1:21, data=stackloss)
How can I access parts of the output.
I tried:
str(Y1)
Formal class 'yagsResult' [package "yags"] with 25 slots
..@ coefficients : num [1:2] -44.13 1.02
..@ coefnames: chr(0)
Y1$coefnames
Error in Y1$coefnames : $ operator not defined for this S4 class
Notice those ``@'' signs in the output of str(). These thingies
(``coefficients'' and ``coefnames' are ``slots'', not components.
This structure was introduced into S/R purely with the intent of
totally bewildering people. It serves no genuinely useful purpose ...
(Flame-bait! :-) )
You can get at them via a similar syntax:
[EMAIL PROTECTED]
The S4 control freaks would tell you that you are in severe danger
of being condemned to eternal perdition for doing so however. They
would say that you extract things from S4 objects *only* using the
extractor functions provided. How one knows what extractor functions
actually *are* provided remains a mystery to me, but there it is! :-)
cheers,
Rolf Turner
##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.