---------
On Sat, 10/6/17, Martin Maechler <maech...@stat.math.ethz.ch> wrote:
Subject: Re: [Rd] [bug] droplevels() also drop object attributes (comment…)
To: "R Development" <R-devel@r-project.org>
Cc: "Serge Bibauw" <sbib...@gmail.com>
> Suharto Anggono Suharto Anggono via R-devel
> on Thu, 8 Jun 2017 16:43:48 + writes:
> * Be careful with "contrasts" attribute. If the number of levels is
reduced, the original contrasts matrix is no longer valid.
> Example case:
> x <-
* Be careful with "contrasts" attribute. If the number of levels is reduced,
the original contrasts matrix is no longer valid.
Example case:
x <- factor(c("a", "a", "b", "b", "b"), levels = c("a", "b", "c"))
contrasts(x) <- contr.treatment(levels(x), contrasts=FALSE)[, -2, drop=FALSE]
> Martin Maechler
> on Tue, 16 May 2017 11:01:23 +0200 writes:
> Serge Bibauw
> on Mon, 15 May 2017 11:59:32 -0400 writes:
>> Hi,
>> Just reporting a small bug… not really a big deal, but I
>> don’t think that
> Serge Bibauw
> on Mon, 15 May 2017 11:59:32 -0400 writes:
> Hi,
> Just reporting a small bug… not really a big deal, but I don’t think that
is intended: droplevels() also drops all object’s attributes.
Yes. The help page for droplevels (or the simple
Hi,
Just reporting a small bug… not really a big deal, but I don’t think that is
intended: droplevels() also drops all object’s attributes.
Example:
> > test <- c("hello", "something", "hi")
> > test <- factor(test)
> > comment(test) <- "this is a test"
> > attr(test, "description") <- "this