[Rd] labels.lm (PR#7417)

Heather.Turner at warwick.ac.uk Heather.Turner at warwick.ac.uk
Mon Dec 13 14:55:24 CET 2004


Full_Name: Heather Turner
Version: 2.0.1
OS: Windows XP
Submission from: (NULL) (137.205.240.44)


labels.lm does not produce term labels for estimable terms as intended, e.g.
> example(lm)
> labels(lm.D9)
character(0)

The function code is as follows:
> labels.lm
function (object, ...) 
{
    tl <- attr(object$terms, "term.labels")
    asgn <- object$asgn[object$qr$pivot[1:object$rank]]
    tl[unique(asgn)]
}
<environment: namespace:base>

Replacing object$asgn with object$assign appears to solve the problem:
> labels.lm2 <- 
+ function (object, ...) 
+ {
+     tl <- attr(object$terms, "term.labels")
+     asgn <- object$assign[object$qr$pivot[1:object$rank]]
+     tl[unique(asgn)]
+ }  
> 
> labels.lm2(lm.D9)
[1] "group"



More information about the R-devel mailing list