[R] Strange warning in summary.lm

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jul 19 15:27:54 CEST 2007


On Thu, 19 Jul 2007, Peter Dalgaard wrote:

> Prof Brian Ripley wrote:
>> On Thu, 19 Jul 2007, Peter Dalgaard wrote:
>>
>>
>>> ONKELINX, Thierry wrote:
>>>
>>>> The problem also exists in a clean workspace. But I've found the
>>>> troublemaker. I had set options(OutDec = ","). Resetting this to
>>>> options(OutDec = ".") solved the problem.
>>>>
>>>> Thanks,
>>>>
>>>> Thierry
>>>>
>>>>
>>> Oups. That sounds like there's a bug somewhere. Can you cook up a
>>> minimal example which shows the behaviour?
>>>
>>
>> Any use of summary.lm will do it (e.g. example(lm)).  The problem is in
>> printCoefmat, at
>>
>>     x0 <- (xm[okP] == 0) != (as.numeric(Cf[okP]) == 0)
>>
>> and yes, it looks like an infelicity to me.
>>
>>
> Ick. Any better ideas than
>
> printsAs0 <- scan(con <- textConnection(Cf[okP), dec=options("outDec")) ; close(con)
> x0 <- (xm[okP] == 0) != printsAs0
>
> ?

Yes, several.  That assumes that getOption("OutDec") (which is what you 
need) is a single char since scan() does.  If so, chartr() will do the job 
and more generally sub() would.  Alternatively, we could figure out what 
representations of zero are possible and grep for them.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list