as.sparse | R Documentation |
Convert to from dense to sparse representation
as.sparse(x, mask, ...)
x |
the object to make sparse, e.g. |
mask |
the elements to retain |
... |
additional arguments |
mask
can be an integer vector of 1D indices or a mask volume of class LogicalNeuroVol
bvol <- NeuroVol(array(runif(24*24*24), c(24,24,24)), NeuroSpace(c(24,24,24), c(1,1,1)))
indmask <- sort(sample(1:(24*24*24), 100))
svol <- as.sparse(bvol, indmask)
mask <- LogicalNeuroVol(runif(length(indmask)), space=space(bvol), indices=indmask)
sum(mask) == 100
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.