sparsify: Sparsify a matrix-like object.

Description Usage Arguments Details Value Note for Developers Author(s) See Also Examples

Description

WARNING: This is intended for developers and not end-users; see ‘Note for Developers’.

Usage

1
sparsify(x, return_class, ...)

Arguments

x

A matrix-like object, e.g., matrix, data.frame, or data.table.

return_class

The class of the returned object.

...

Additional arguments, for use in specific methods.

Details

A generic function to sparsify a matrix-like object, e.g., matrix, data.frame, or data.table.

While the concepts of "sparsify" and "densify" are inverse operations, in general, identical(densify(sparsify(x)), x) is FALSE. This is because the return value of sparsify() is generally not compatible with the signature of a densify() method.

Value

An object with the concepts of a key and a value. The specific return value is left to individual methods. For example, the sparsify,SimpleList,matrix-method returns a SimpleList object with an integer key element and a matrix value element.

Note for Developers

This generic and method are used internally by the SparseSummarizedExperiment package but are not intended for use by end-users. End-users with their data as dense matrix objects should use the SparseAssays constructor in conjunction with the associated combine method to sparify their data and return a valid SparseAssays object.

One particular word of warning, the 'value' element returned by sparsify may contain the NA-row and will not have NAs in the 'key' element.

Author(s)

Peter Hickey, peter.hickey@gmail.com

See Also

Examples

1
# See ?SimpleListSparseAssays

PeteHaitch/SparseSummarizedExperiment documentation built on May 8, 2019, 1:31 a.m.