How to take transpose of a big.matrix object?
I have a 8000 x 8000 big.matrix object and I need to perform transpose and multiplication. How to do it?
b <- as.big.matrix(basis)
bTransb <- t(b) %*% b
This gives me the following error
Error in t.default(b) : argument is not a matrix
I have imported bigalgebra library. Still not working.
I'm not sure with {bigmemory}, but you can do it with {bigstatsr} (disclaimer: I'm the author), which uses a similar format.
# Sample data
a <- matrix(0, 8000, 8000); a[] <- rnorm(length(a))
# devtools::install_github("privefl/bigstatsr")
library(bigstatsr)
b <- as_FBM(a)
class(b)
btrans <- big_crossprodSelf(b)
dim(btrans)
class(btrans)
# Verification
all.equal(btrans[], crossprod(b[]))