From h.wickham at gmail.com  Mon Jul  1 23:01:22 2013
From: h.wickham at gmail.com (Hadley Wickham)
Date: Mon, 1 Jul 2013 16:01:22 -0500
Subject: [Rd] Problem with anova and the new abbreviation restrictions
In-Reply-To: <51D1EBDF.9050307@mayo.edu>
References: <51D1EBDF.9050307@mayo.edu>
Message-ID: <CABdHhvGYarcJ83fk9D2Dt0Wu1hQCr=1ZowQxy+X8uaET5RH-YQ@mail.gmail.com>

On Mon, Jul 1, 2013 at 3:51 PM, Terry Therneau <therneau at mayo.edu> wrote:
> An unwanted side effect of the new restrictions on abrreviated names.
>
> The anova.coxph command, in a slavish copy of anova.lm etc, returns a data
> frame with column labels of
>     loglik  Chisq  Df  Pr(>|Chi|)
>
> If one tries to extract the final column of the table errors result since it
> is not a standard R variable name.
>
>> afit <- anova(lm(conc ~ uptake, CO2))
>> afit$P
> [1] 2.905607e-06           NA
> Warning message:
> In `$.data.frame`(afit, P) : Name partially matched in data frame

I think it's reasonable to emit a warning in that case, although it
would be more useful to say:

Warning message:
P partially matched to `Pr(>|Chi|)` in data frame

Hadley

--
Chief Scientist, RStudio
http://had.co.nz/



[Rd] Problem with anova and the new abbreviation restrictions
Hadley Wickham