Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

SFBM-class

Class SFBM


Description

A reference class for storing and accessing sparse matrix-like data stored in files on disk.

Convert a dgCMatrix or dsCMatrix to an SFBM.

Usage

as_SFBM(spmat, backingfile = tempfile())

Arguments

spmat

A dgCMatrix (non-symmetric sparse matrix of type 'double') or dsCMatrix (symmetric sparse matrix of type 'double').

backingfile

Path to file where to store data. Extension .sbk is automatically added.

Details

An object of class SFBM has many fields:

  • $address: address of the external pointer containing the underlying C++ object to be used as a XPtr<SFBM> in C++ code

  • $extptr: (internal) use $address instead

  • $nrow: number of rows

  • $ncol: number of columns

  • $nval: number of non-zero values

  • $p: vector of column positions

  • $backingfile or $sbk: File with extension 'sbk' that stores the data of the SFBM

  • $rds: 'rds' file (that may not exist) corresponding to the 'sbk' file

  • $is_saved: whether this object is stored in $rds?

And some methods:

  • $save(): Save the SFBM object in $rds. Returns the SFBM.

  • $add_columns(): Add new columns from another sparse dgCMatrix.

Value

The new SFBM.

Examples

spmat <- Matrix::rsparsematrix(1000, 1000, 0.01)
class(spmat)
(X <- as_SFBM(spmat))

bigsparser

Sparse Matrix Format with Data on Disk

v0.4.4
GPL-3
Authors
Florian Privé [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.