Rev 6994 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
split <- function(x, f) UseMethod("split")split.default <- function(x, f) {f <- factor(f) # drop extraneous levelsif(is.null(class(x)) && is.null(names(x)))return(.Internal(split(x, f)))## elself <- levels(f)y <- vector("list", length(lf))names(y) <- lffor(k in lf){y[[k]] <- x[f==k]}y}split.data.frame <- function(x, f) {lapply(split(1:nrow(x), f), function(ind) x[ind, , drop = FALSE ])}