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 thebig.matrix
.- length
signature(x = "big.matrix")
: returns the product of the dimensions of thebig.matrix
.- dimnames<-
signature(x = "big.matrix", value = "list")
: set the row and column names, prohibited by default (seebigmemory
to override).- dimnames
signature(x = "big.matrix")
: get the row and column names.- head
signature(x = "big.matrix")
: get the first 6 (orn
) rows.- as.matrix
signature(x = "big.matrix")
: coerce abig.matrix
to amatrix
.- is.big.matrix
signature(x = "big.matrix")
: returnTRUE
if it's abig.matrix
.- is.filebacked
signature(x = "big.matrix")
: returnTRUE
if there is a file-backing.- is.separated
signature(x = "big.matrix")
: returnTRUE
if thebig.matrix
is organized as a separated column vectors.- is.sub.big.matrix
signature(x = "big.matrix")
: returnTRUE
if this is a sub-matrix of abig.matrix
.- ncol
signature(x = "big.matrix")
: returns the number of columns.- nrow
signature(x = "big.matrix")
: returns the number of rows.signature(x = "big.matrix")
: a traditionalprint()
is intentionally disabled, and returnshead(x)
unlessoptions()$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 (orn
) rows.- typeof
signature(x = "big.matrix")
: return the type of the atomic elements of thebig.matrix
.- write.big.matrix
signature(bigMat = "big.matrix", fileName = "character")
: produce an ASCII file from thebig.matrix
.- apply
signature(x = "big.matrix")
:apply()
whereMARGIN
may only be 1 or 2, but otherwise conforming to what you would expect fromapply()
.
Author(s)
Michael J. Kane and John W. Emerson bigmemoryauthors@gmail.com
See Also
Examples
showClass("big.matrix")