R: Class "big.matrix"

big.matrix-class {bigmemory} | R Documentation

## Class "big.matrix"

### Description

The `big.matrix` class is designed for matrices with elements of type `double`, `integer`, `short`, or `char`. A `big.matrix` acts much like a traditional R matrix, but helps protect the user from many inadvertent memory-consuming pitfalls of traditional R matrices and data frames. The objects are allocated to shared memory, and if file-backing is used they may exceed virtual memory in size. Sadly, 32-bit operating system constraints – largely Windows and some MacOS versions –will be a limiting factor with file-backed matrices; 64-bit operating systems are recommended.

### Objects from the Class

Unlike many R objects, objects should not be created by calls of the form `new("big.matrix", ...)`. The functions `big.matrix()` and `filebacked.big.matrix()` are intended for the user.

### Slots

`address`:

  Object of class `"externalptr"` points to the memory location of the C++ data structure.

### Methods

As you would expect:

[<-

  `signature(x = "big.matrix", i = "ANY", j = "ANY")`: ...

[<-

  `signature(x = "big.matrix", i = "ANY", j = "missing")`: ...

[<-

  `signature(x = "big.matrix", i = "missing", j = "ANY")`: ...

[<-

  `signature(x = "big.matrix", i = "missing", j = "missing")`: ...

[<-

  `signature(x = "big.matrix", i = "matrix", j = "missing")`: ...

[

  `signature(x = "big.matrix", i = "ANY", j = "ANY", drop = "missing")`: ...

[

  `signature(x = "big.matrix", i = "ANY", j = "ANY", drop = "logical")`: ...

[

  `signature(x = "big.matrix", i = "ANY", j = "missing", drop = "missing")`: ...

[

  `signature(x = "big.matrix", i = "ANY", j = "missing", drop = "logical")`: ...

[

  `signature(x = "big.matrix", i = "matrix", j = "missing", drop = "logical")`: ...

[

  `signature(x = "big.matrix", i = "missing", j = "ANY", drop = "missing")`: ...

[

  `signature(x = "big.matrix", i = "missing", j = "ANY", drop = "logical")`: ...

[

  `signature(x = "big.matrix", i = "missing", j = "missing", drop = "missing")`: ...

[

  `signature(x = "big.matrix", i = "missing", j = "missing", drop = "logical")`: ...

The following are probably more interesting:

describe

  `signature(x = "big.matrix")`: provide necessary and sufficient information for the sharing or re-attaching of the object.

dim

  `signature(x = "big.matrix")`: returns the dimension of the `big.matrix`.

length

  `signature(x = "big.matrix")`: returns the product of the dimensions of the `big.matrix`.

dimnames<-

  `signature(x = "big.matrix", value = "list")`: set the row and column names, prohibited by default (see `bigmemory` to override).

dimnames

  `signature(x = "big.matrix")`: get the row and column names.

head

  `signature(x = "big.matrix")`: get the first 6 (or `n`) rows.

as.matrix

  `signature(x = "big.matrix")`: coerce a `big.matrix` to a `matrix`.

is.big.matrix

  `signature(x = "big.matrix")`: return `TRUE` if it's a `big.matrix`.

is.filebacked

  `signature(x = "big.matrix")`: return `TRUE` if there is a file-backing.

is.separated

  `signature(x = "big.matrix")` : return `TRUE` if the `big.matrix` is organized as a separated column vectors.

is.sub.big.matrix

  `signature(x = "big.matrix")`: return `TRUE` if this is a sub-matrix of a `big.matrix`.

ncol

  `signature(x = "big.matrix")`: returns the number of columns.

nrow

  `signature(x = "big.matrix")`: returns the number of rows.

print

  `signature(x = "big.matrix")`: a traditional `print()` is intentionally disabled, and returns `head(x)` unless `options()$bm.print.warning==FALSE`; in this case, `print(x[,])` is the result, which could be very big!

sub.big.matrix

  `signature(x = "big.matrix")`: for contiguous submatrices.

tail

  `signature(x = "big.matrix")`: returns the last 6 (or `n`) rows.

typeof

  `signature(x = "big.matrix")`: return the type of the atomic elements of the `big.matrix`.

write.big.matrix

  `signature(bigMat = "big.matrix", fileName = "character")`: produce an ASCII file from the `big.matrix`.

apply

  `signature(x = "big.matrix")`: `apply()` where `MARGIN` may only be 1 or 2, but otherwise conforming to what you would expect from `apply()`.

### Author(s)

Michael J. Kane and John W. Emerson <bigmemoryauthors@gmail.com>

### See Also

`big.matrix`

### Examples

    showClass("big.matrix")

[Package bigmemory version 4.5.36 Index]