Hi, I noticed that by() returns an object of class 'by', regardless of what its argument 'simplify' is. ?by says that it always returns a list if simplify=FALSE, yet by.data.frame shows:
---<--------------------cut here---------------start------------------->--- function (data, INDICES, FUN, ..., simplify = TRUE) { if (!is.list(INDICES)) { IND <- vector("list", 1L) IND[[1L]] <- INDICES names(IND) <- deparse(substitute(INDICES))[1L] } else IND <- INDICES FUNx <- function(x) FUN(data[x, , drop = FALSE], ...) nd <- nrow(data) ans <- eval(substitute(tapply(1L:nd, IND, FUNx, simplify = simplify)), data) attr(ans, "call") <- match.call() class(ans) <- "by" ans } <environment: namespace:base> ---<--------------------cut here---------------end--------------------->--- One could force a list by wrapping it around an lapply(by.object, "["), but this is not possible if the object contains S4 objects. How does one force a list in those cases? Cheers, -- Seb ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel