Re: [Rd] [bug] droplevels() also drop object attributes (comment…)

2017-06-14 Thread Suharto Anggono Suharto Anggono via R-devel
--------- 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>

Re: [Rd] [bug] droplevels() also drop object attributes (comment…)

2017-06-09 Thread Martin Maechler
> 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 <-

Re: [Rd] [bug] droplevels() also drop object attributes (comment…)

2017-06-08 Thread Suharto Anggono Suharto Anggono via R-devel
* 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]

Re: [Rd] [bug] droplevels() also drop object attributes (comment…)

2017-06-06 Thread Martin Maechler
> 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

Re: [Rd] [bug] droplevels() also drop object attributes (comment…)

2017-05-16 Thread Martin Maechler
> 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

[Rd] [bug] droplevels() also drop object attributes (comment…)

2017-05-15 Thread Serge Bibauw
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