[R] confused about names()
Kurt Hornik
Kurt.Hornik at ci.tuwien.ac.at
Sun Feb 18 11:28:02 CET 2001
>>>>> John Aitchison writes:
> Hi all .. there is no doubt a simple answer to this, but it eludes me.
> In the first session below ( with jarque.bera.test) you will see that
> p.value prints with a name of X-squared .
> This is easily fixed by changing the source to assign a
> more appropriate name - no name is assigned in the source listing
> below (the original source code of jarque.bera.test() from tseries).. but
> what I don't understand is how this (the name of X-squared) has arisen.
> In the second session (with Box.test from ts) , p.value prints without
> a name as I would expect .. the code looks superficially similar to me, so
> obviously I am missing something.
> wait a minute .. names seem to be inherited! yes. so this is really
> more likely a minor glitch in jarque.bera.test due to assigning
> names(STATISTIC) <- "X-squared"
> too early, or omitting to assign a name to PVAL
Interesting. I think most of the ctest functions will actually come up
with a names attribute of the test statistic as eventually we do
PVAL <- psomething(STATISTIC, PARAMS, ...)
For htest output this is not a problem because print.htest() actually
uses format.pval() for printing which gets rid of the names attribute.
The question is whether we think that this is a bug.
-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list