SparseArray-class: The SparseArray class

Description Fields Methods


This class represents an array with any number of dimensions, in which a significant proportion of entries are zero. The coordinates of nonzero entries are stored along with their values, with all remaining entries assumed to be zero. Methods are provided to index into the array in the standard way, using matrix or vector indices; and for coercing between SparseArray objects and standard (dense) arrays.



Vector of nonzero data values


Integer matrix of nonzero data locations, one per row


Integer vector of dimensions



Permute the dimensions of the array

apply(margin, fun, ...)

Apply a function to margins of the array


Flip the array along one or more directions

setCoordinatesAndData(newCoords, newData)

Update the nonzero locations and data values in the array


Change the dimensions of the image

Search within the tractor.base package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.