SFBM_corr_compact-class | R Documentation |
A reference class for storing and accessing from disk a sparse correlation matrix where non-zero values in columns are mostly contiguous. It rounds correlation values with precision 1/32767 to store them using 2 bytes only. This class has been specifically designed for package 'bigsnpr'.
Convert a 'dgCMatrix' or 'dsCMatrix' to an SFBM_corr_compact.
as_SFBM_corr_compact(spmat, backingfile = tempfile())
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 |
It inherits the fields and methods from class SFBM_compact.
The new SFBM_corr_compact.
spmat2 <- as(cor(iris[1:4]), "dsCMatrix")
(X2 <- as_SFBM_corr_compact(spmat2))
(bin <- readBin(X2$sbk, what = integer(), size = 2, n = 100))
matrix(bin / 32767, 4)
spmat2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.