Perform `colSums(X^2)` on FBM object
Closed this issue · 2 comments
fmorgante commented
Hi Florian, I need to do colSums(X^2)
where X is an FBM object. Do you have any suggestion on how to do that using bigstatsr functions? I don't seem to find an efficient way.
privefl commented
Hi, I can see 3 ways:
- either using
big_apply()
to simply do it in base R by block (look at the examples) - in Rcpp if you know a bit of C++
- with
big_colstats()
, using var(X) = E(X^2) - E(X)^2
fmorgante commented
The third point is a great trick I did not think about. Thank you!