From ripley at stats.ox.ac.uk  Mon Dec 13 15:52:51 2004
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon Dec 13 15:52:56 2004
Subject: [Rd] labels.lm (PR#7417)
In-Reply-To: <20041213135524.1378A1043E@slim.kubism.ku.dk>
References: <20041213135524.1378A1043E@slim.kubism.ku.dk>
Message-ID: <Pine.LNX.4.61.0412131446170.18868@gannet.stats>

Thank you.  It has been that way for six years, so presumably it worked 
once ....

On Mon, 13 Dec 2004 Heather.Turner@warwick.ac.uk wrote:

> 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"
>
> ______________________________________________
> R-devel@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
Brian D. Ripley,                  ripley@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


[Rd] labels.lm (PR#7417)
Prof Brian Ripley