DataFrameList-class {IRanges} | R Documentation

## List of DataFrames

### Description

Represents a list of `DataFrame` objects. The `SplitDataFrameList` class contains the additional restriction that all the columns be of the same name and type. Internally it is stored as a list of `DataFrame` objects and extends `List`.

### Accessors

In the following code snippets, `x` is a `DataFrameList`.

  `dim(x)`: Get the two element integer vector indicating the number of rows and columns over the entire dataset.

  `dimnames(x)`: Get the list of two character vectors, the first holding the rownames (possibly `NULL`) and the second the column names.

  `columnMetadata(x)`: Get the `DataFrame` of metadata along the columns, i.e., where each column in `x` is represented by a row in the metadata. The metadata is common across all elements of `x`. Note that calling `mcols(x)` returns the metadata on the `DataFrame` elements of `x`.

  `columnMetadata(x) <- value`: Set the `DataFrame` of metadata for the columns.

### Subsetting

In the following code snippets, `x` is a `SplitDataFrameList`. In general `x` follows the conventions of `SimpleList`/`CompressedList` with the following addition:

  `x[i,j,drop]`: If matrix subsetting is used, `i` selects either the list elements or the rows within the list elements as determined by the `[` method for `SimpleList`/`CompressedList`, `j` selects the columns, and `drop` is used when one column is selected and output can be coerced into an `AtomicList` or `IntegerRangesList` subclass.

  `x[i,j] <- value`: If matrix subsetting is used, `i` selects either the list elements or the rows within the list elements as determined by the `[<-` method for `SimpleList`/`CompressedList`, `j` selects the columns and `value` is the replacement value for the selected region.

### Constructor

  `DataFrameList(...)`: Concatenates the `DataFrame` objects in `...` into a new `DataFrameList`.

  `SplitDataFrameList(..., compress = TRUE, cbindArgs = FALSE)`: If `cbindArgs` is `FALSE`, the `...` arguments are coerced to `DataFrame` objects and concatenated to form the result. The arguments must have the same number and names of columns. If `cbindArgs` is `TRUE`, the arguments are combined as columns. The arguments must then be the same length, with each element of an argument mapping to an element in the result. If `compress = TRUE`, returns a `CompressedSplitDataFrameList`; else returns a `SimpleSplitDataFrameList`.

### Combining

In the following code snippets, objects in `...` are of class `DataFrameList`.

  `rbind(...)`: Creates a new `DataFrameList` containing the element-by-element row concatenation of the objects in `...`.

  `cbind(...)`: Creates a new `DataFrameList` containing the element-by-element column concatenation of the objects in `...`.

### Transformation

  `transform(`_data`, ...)`: Transforms a `SplitDataFrame` in a manner analogous to the base `transform`, where the columns are `List` objects adhering to the structure of `_data`.

### Coercion

In the following code snippets, `x` is a `DataFrameList`.

  `as(from, "DataFrame")`: Coerces a `SplitDataFrameList` to a `DataFrame`, which has a column for every column in `from`, except each column is a `List` with the same structure as `from`.

  `as(from, "SplitDataFrameList")`: By default, simply calls the `SplitDataFrameList` constructor on `from`. If `from` is a `List`, each element of `from` is passed as an argument to `SplitDataFrameList`, like calling `as.list` on a vector. If `from` is a `DataFrame`, each row becomes an element in the list.

  `stack(x, index.var = "name")`: Unlists `x` and adds a column named `index.var` to the result, indicating the element of `x` from which each row was obtained.

  `as.data.frame(x, row.names = NULL, optional = FALSE, ..., value.name = "value", use.outer.mcols = FALSE, group_name.as.factor = FALSE)`: Coerces `x` to a `data.frame`. See as.data.frame on the `List` man page for details (?`List`).

### Author(s)

Michael Lawrence

### See Also

`DataFrame`

[Package IRanges version 2.24.1 Index]