R-alpha: terms class

Thomas Lumley (thomas@biostat.washington.edu)
Mon, 18 Nov 1996 08:50:57 -0800 (PST)


Date: Mon, 18 Nov 1996 08:50:57 -0800 (PST)
From: Thomas Lumley <thomas@biostat.washington.edu>
To: r-testers@stat.math.ethz.ch
Subject: R-alpha: terms class
In-Reply-To: <Pine.SUN.3.91.961117105614.1562B-100000@chekov>


In S the output of terms() has class "terms".  I tried to add the "terms" 
class in R and found two problems that I don't understand.

>tt<-terms(y~x)
>class(tt)<-c("terms","formula")
> class(tt)
[1] "terms"   "formula"
> attr(tt,"intercept")<-1
> class(tt)
[1] "formula"
> 

Also, when I defined a "[.terms" method it was ignored, though a 
"[.formula" was called if it was defined. For some reason R seems to be 
very determined to treat terms objects as formulas.

thomas lumley
UW biostatistics

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- For info or help, send "info" or "help",
To [un]subscribe, send "[un]subscribe"
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-