Prof Brian Ripley <[EMAIL PROTECTED]> writes: > > No, it comes from > > > get("[.factor") > function (x, i, drop = FALSE) > { > y <- NextMethod("[") > class(y) <- oldClass(x) > attr(y, "contrasts") <- attr(x, "contrasts") > attr(y, "levels") <- attr(x, "levels") > if (drop) > factor(y) > else y > } > > > attributes(af[1:2, drop=TRUE]) > $levels > [1] "A" "B" > > $class > [1] "factor" > > > attributes(af[1:2, drop=FALSE]) > $class > [1] "factor" > > $levels > [1] "A" "B" > > and one needs to swap the orders. I am about to commit the change.
I got to about the same spot and started thinking about methods for putting attributes back in the same order that they were found, as in A <- attributes(x) attributes(y) <- A[names(A) %in% c("class","contrasts","levels")] Just swapping the order is probably fine, though. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-devel