Rev 6237 | 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)))return(.Internal(split(x, f)))## elself <- levels(f)retval <- list()for(k in lf){retval[[k]] <- x[f==k]}retval}split.data.frame <- function( x, f ){lapply( split( 1:nrow(x), f ), function(ind) x[ ind, , drop = FALSE ] )}