listData = structure(list(), names = character())),
function(x, do.NULL = TRUE, prefix = "row")
rn <- paste(prefix, seq_len(nr), sep = "")
function(x, do.NULL = TRUE, prefix = "col")
if (!identical(do.NULL, TRUE)) warning("do.NULL arg is ignored ",
stop("DataFrame object with NULL colnames, please fix it ",
stop("missing values not allowed in rownames")
stop("'value' must be a character vector ",
return("length of 'nrows' slot must be 1")
return("number of rows must be non-negative")
return("number of row names and number of rows differ")
return("column names should not be NULL")
return("number of columns and number of column names differ")
DataFrame <- function(..., row.names = NULL, check.names = TRUE)
stop("'check.names' must be TRUE or FALSE")
dotvalues <- sapply(qargs[emptynames], function(arg) deparse(arg)[1L])
nrows <- ncols <- integer(length(varnames))
element <- try(as(listData[[i]], "DataFrame"), silent = TRUE)
stop("cannot coerce class \"", class(listData[[i]]),
varlist[[i]] <- as.list(element, use.names = FALSE)
if (((length(dim(listData[[i]])) > 1) || (ncol(element) > 1)))
varnames[[i]] <- paste(varnames[[i]], colnames(element), sep = ".")
} else if (is.list(listData[[i]]) && length(names(listData[[i]])))
for (i in which((nrows > 0L) & (nrows < nr) & (nr %% nrows == 0L))) {
recycle <- rep(seq_len(nrows[i]), length.out = nr)
varlist[[i]] <- lapply(varlist[[i]], `[`, recycle, drop=FALSE)
stop("different row counts implied by arguments")
varlist <- unlist(varlist, recursive = FALSE, use.names = FALSE)
if (length(varlist) && length(row.names) != nr)
if (!missing(j) || length(list(...)) > 0)
stop("attempt to select less than one element")
stop("attempt to select more than one element")
if (is.numeric(i) && (i < 1L || i > ncol(x) + 1L))
stop(paste(lv, "elements in value to replace",
i <- normalizeSingleBracketSubscript(i, x, byrow=TRUE, exact=FALSE)
warning("parameters in '...' not supported")
list_style_subsetting <- (nargs() - !missing(drop)) < 3L
if (list_style_subsetting || !missing(j)) {
warning("'drop' argument ignored by list-style subsetting")
if (missing(drop))  # drop by default if only one column left
i <- normalizeSingleBracketSubscript(i, x, byrow=TRUE)
stop("provided ", value_ncol, " variables ",
value[[((j - 1L) %% value_ncol) + 1L]]))
i2 <- normalizeSingleBracketSubscript(i, x, byrow=TRUE,
if (is(value, "list") || is(value, "List"))
stop(paste(lv, "rows in value to replace",
if (!length(newcn) && max(j) > length(x)) {
newcn <- paste("V", seq.int(length(x) + 1L, max(j)),
if (length(newcn) != sum(j > length(x)))
stop("new columns would leave holes after ",
if (length(newrn) == 0L && li > 0L && max(i) > nrow(x))
newrn <- as.character(seq.int(nrow(x) + 1L, max(i)))
lapply(x@listData[j], function(y) {y[i] <- value; y})
stop(paste(nrv, "rows in value to replace",
value[rep(seq_len(nrv), length.out = li), ,
newcn <- rep(names(value), length.out = length(j))
if (length(newrn) == 0L && li > 0L && max(i) > nrow(x)) {
newrn <- rep(rownames(value), length.out = length(i))
else v[i] <- if (is.null(v)) rv else as(rv, class(v))
oldcn <- head(colnames(x), length(x) - length(newcn))
x@nrows <- length(x[[1]]) # we should always have a column
hasNonDefaultMethod <- function(f, signature) {
droplevels.DataFrame <- function(x, except=NULL) {
drop.levels <- vapply(x, canDropLevels, NA)
nms <- sapply(tail(substitute(list(...)), -1), deparse)
environment(x) <- list2env(setNames(list(...), nms), parent = environment(x))
as.data.frame.DataFrame <- function(x, row.names=NULL, optional=FALSE, ...)
if (is(y, "SimpleList") || is(y, "CompressedList"))
m <- matrix(logical(), nrow = nrow(x), ncol = 0L)
nrows = nrow(from), rownames = rn, check=FALSE)
do.call(DataFrame, c(df[1], lapply(df[factors], Rle), df["Freq"]))
row.names <- if (!anyDuplicated(names(from))) names(from) else NULL
new2("DataFrame", listData = setNames(list(from), "X"),
nrows = length(from), rownames = row.names, check=FALSE)
do.call(DataFrame, c(from, check.names = FALSE))
setAs("NULL", "DataFrame", function(from) as(list(), "DataFrame"))
df <- new2("DataFrame", nrows = NROW(from), check=FALSE)