From Torsten.Hothorn at uzh.ch  Fri Jul  7 15:06:07 2017
From: Torsten.Hothorn at uzh.ch (Torsten Hothorn)
Date: Fri, 7 Jul 2017 15:06:07 +0200 (CEST)
Subject: [Rd] attributes on symbols
In-Reply-To: <CAF8bMcY0Sq9qf-24VKQe3BV+fi4KnLppbU221dXZkkS1_862vQ@mail.gmail.com>
References: <CAF8bMcY0Sq9qf-24VKQe3BV+fi4KnLppbU221dXZkkS1_862vQ@mail.gmail.com>
Message-ID: <alpine.DEB.2.20.1707071505480.9494@achilles>


Here is a simpler example:

> ex <- as.name("a")
> attr(ex, "test") <- 1
> quote(a)
a
attr(,"test")
[1] 1

Torsten

On Thu, 6 Jul 2017, William Dunlap wrote:

> The multcomp package has code in multcomp:::expression2coef that attaches the 'coef' attribute to
> symbols.? Since there is only one symbol object in a session with a given name, this means that
> this attaching has a global effect.? Should this be quietly allowed or should there be a warning or
> an error?
> E.g.,
> 
> str(quote(Education))
> # symbol Education
> lmod <- stats::lm(Fertility ~ ., data = datasets::swiss)
> glmod <- multcomp::glht(lmod, c("Agriculture=0", "Education=0"))
> str(quote(Education))
> # symbol Education
> # - attr(*, "coef")= num 1
> 
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
> 
>


[Rd] attributes on symbols
Torsten Hothorn