# combine factor levels, coerce to character
## this coercion needed only because we extracted ([[) above
## external objects should support external combination (c)
## We are overriding all 'formula' calls to aggregate, and
## stats:::aggregate.formula depends on quoting a formula expression
## (x ~ y) in its first argument. Thus, we need some computing on the
## language, which may not be very robust.
## depending on the formula, this may or not be a valid subclass
## of DataFrame, so we just explicitly create a DataFrame here

setMethod("rbind", "DataFrame", function(..., deparse.level=1) {
hasrows <- unlist(lapply(args, nrow), use.names=FALSE) > 0L
hascols <- unlist(lapply(args, ncol), use.names=FALSE) > 0L
stop("number of columns for arg ", i, " do not match those of first arg")
stop("column names for arg ", i, " do not match those of first arg")
ans@nrows <- sum(unlist(lapply(args, nrow), use.names=FALSE))
cl <- unlist(lapply(as.list(df, use.names = FALSE), class))
factors <- unlist(lapply(as.list(df, use.names = FALSE), is.factor))
cols <- lapply(seq_len(length(df)), function(i) {
if (any(isRle) && !all(isRle)) # would fail dispatch to c,Rle
if (factors[i]) { # combine factor levels, coerce to character
levs <- unique(unlist(lapply(cols, levels), use.names=FALSE))
rectangular <- length(dim(cols[[1]])) == 2L
ans <- new("DataFrame", listData = cols, nrows = length(cols[[1]]))
rn <- unlist(lapply(args, rownames), use.names=FALSE)
if (all(sapply(args, function(x) identical(mcols(x), df_mcols))))
setMethod("aggregate", "formula", function(x, data, ...) {
} else eval(mc, parent.frame(2)) ## for e.g. data.frame
setMethod("mstack", "DataFrame", function(..., .index.var = "name") {

"replacement value must be the same length as x"
"replacement value must either be NULL or a CharacterList"
"column counts or names differ across elements"
"metadata columns must be identical across elements"
## Casting DataFrameList -> DataFrame implies cast to SplitDataFrameList
### S3/S4 combo for as.data.frame.DataFrameList
"'row.names' must be NULL or a character vector"
"'optional' and arguments in '...' ignored"
## Behaves like as.list() on a vector, while SplitDataFrameList() is like list()