Binmat-class {Cardinal} | R Documentation

## On-Disk Matrix Class Using On-Demand Disk Reads

### Description

The Binmat class implements on-disk matrices with efficient access to columns. Values within each column are contiguously stored in a binary file on disk. The columns themselves need not be stored contiguously. Only the accessed elements of the matrix are loaded into memory.

### Usage

    ## Instance creation
    Binmat(
        files,
        nrow, ncol,
        offsets = 0,
        extents = rep(nrow, ncol),
        datatype = c("16-bit integer",
            "32-bit integer",
            "64-bit integer",
            "32-bit float",
            "64-bit float"),
        dimnames = NULL,
        ...)

    ## Additional methods documented below

### Arguments

`files` | The file(s) where the matrix is stored.
`nrow` | The number of rows in the on-disk matrix.
`ncol` | The number of columns in the on-disk matrix.
`offsets` | The positions of the first value of each column in number of bytes from the beginning of the file.
`extents` | The length of each column.
`datatype` | The binary data type.
`dimnames` | The 'dimnames' giving the dimension names for the matrix, analogous to the 'dimnames' attribute of an ordinary R matrix. This must be a list of length 2 or `NULL`.
`...` | Additional arguments passed to the constructor.

### Slots

`files`:

  A `factor` giving the full file paths of the binary files storing the matrix (or matrices) on disk. Length must be equal to the number of columns.

`offsets`:

  A `numeric` vector giving the positions of the first value of each column in number of bytes from the beginning of the file.

`extents`:

  A `numeric` vector giving the length of each column.

`datatype`:

  A `factor` vector giving the binary data types of each element of the matrix (or matrices) on disk. Length must be equal to the number of columns.

`dim`:

  A length 2 integer vector analogous to the 'dim' attribute of an ordinary R matrix.

`dimnames`:

  A length 2 `list` analogous to the 'dimnames' attribute of an ordinary R matrix.

`.__classVersion__`:

  A `Versions` object describing the version of the class used to created the instance. Intended for developer use.

### Extends

`Versioned`

### Creating Objects

`Binmat` instances are usually created through `Binmat()`.

### Methods

Standard generic methods:

`dim(x), dim(x) <- value`:

  Return or set the dimensions of the on-disk matrix.

`dimnames(x), dimnames(x) <- value`:

  Return or set the 'dimnames' of the on-disk matrix.

`colnames(x), colnames(x) <- value`:

  Return or set the column names of the on-disk matrix.

`rownames(x), rownames(x) <- value`:

  Return or set the row names of the on-disk matrix.

`ncol`:

  Return the number of columns in the on-disk matrix.

`nrow`:

  Return the number of columns in the on-disk matrix.

`cbind`:

  Combine on-disk matrices by columns.

`rbind`:

  Not allowed for on-disk matrices. (Always returns an error.)

`Binmat[i, j, ..., drop]`:

  Access elements in the on-disk matrix. A Binmat on-disk matrix can be indexed like an ordinary R matrix. Note however that linear indexing is not supported. Assignment is not currently allowed.

### Author(s)

Kylie A. Bemis

### See Also

`matrix`, `Hashmat`, `SImageSet`

### Examples

    ## Not run:
    ## Create an Binmat object
    Binmat("path/to/file.extension")

    ## End(Not run)

[Package Cardinal version 1.12.1 Index]