Hello, everyone, I don't quite understand the following message:> TTT <- t.test(1:10, y=c(7:20)) > class(TTT)[1] "htest"> TTT@p.valueError: Trying to get slot "p.value" from an object whose class ("htest") is not defined> TTT$p.value[1] 1.855282e-05 Why the message says the class of TTT is not defined while class(TTT) gets "htest"? I appreciate the explanations? -Minghua [[alternative HTML version deleted]]
On Thu, 20 May 2004, Yao, Minghua wrote:> Hello, everyone, > > I don't quite understand the following message: > > > TTT <- t.test(1:10, y=c(7:20)) > > class(TTT) > [1] "htest" > > TTT at p.value > Error: Trying to get slot "p.value" from an object whose class ("htest") > is not defined > > TTT$p.value > [1] 1.855282e-05 > > Why the message says the class of TTT is not defined while class(TTT) > gets "htest"?The classical tests use the S3 class system, not the S4 system. They don't have slots, and they don't have formal class representations (they weren't created with setClass). The message could perhaps be clearer, but it is saying that there is no formal definition of a "htest" class and so you can't use the @ operator on these objects. -thomas
Yao, Minghua wrote:> Hello, everyone, > > I don't quite understand the following message: > > >>TTT <- t.test(1:10, y=c(7:20)) >>class(TTT) > > [1] "htest" > >>TTT at p.value > > Error: Trying to get slot "p.value" from an object whose class ("htest") is not defined > >>TTT$p.value > > [1] 1.855282e-05 > > Why the message says the class of TTT is not defined while class(TTT) gets "htest"? > > I appreciate the explanations?Well, you are mixing S3 with S4 classes. The slot extractor "@" epects an S4 class. And htest is an S3 class .... Uwe Ligges> -Minghua > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html