R-alpha: class for chisquare tests; Thoughts on print & summary
Martin Maechler
Martin Maechler <maechler@stat.math.ethz.ch>
Fri, 22 Aug 1997 08:59:34 +0200
Kurt,
I think we hopefully are coming to an agreement that
1) your ctest collection should make its way into 'R core'
((and you are the one who can make it happen now ..))
2) it should remain S-plus downward compatible as much as
reasonably possible.
My conclusions:
a. keep class 'htest'
b. extend print.htest (AND summary.htest !)
to make it possible to display your extra info.
b2. Yes, add extra arguments to print.htest / summary.htest to
control this behavior.
[this is also done for the correlation matrix
in print.summary.lm in S (not yet in R ..)]
alternatively, you would make a new class 'chisqtest' but give your test
results BOTH classes
class(res) <- c("chisqtest","htest")
Such that you can use 'htest' methods in general, and just one
print.chisqtest
in particular.
General note on 'print' (and 'summary') methods:
~~~~~~~~~~~~ =====
1) I think we should keep to the S convention that EVERY print method
semantically acts as
print.foo <- function(x,.........) {
.........
invisible(x)
}
[[a few days ago, I've patched print.lm (?I think) in order to do this]]
2) For summary, there are two approaches
A. Just print summary information AND return something useful.
B. Don't print anything in summary.foo but return an object of
CLASS 'summary.foo'
AND write a method print.summary.foo
which nicely prints the summary.foo information and
[see remark '1)' on "print"] invisibly returns its object.
Approach 'B' is THE way to go useful for "big" things like 'lm'.
IMHO it should be used in general as soon as quite a bit of "computing"
is involved ("computing" is NOT computer intensive; just things that are
tedious to re-type).
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-