show {MatrixExtra} | R Documentation |
Quick Glance at Sparse Objects
Description
Shows some basic information about a sparse matrix or sparse vector object, without printing a subset of its entries as 'Matrix' would do.
Note that this package will by default override the 'show' methods of sparse objects, but not the ‘print' methods - for example, if one defines a variable ’X' containing a sparse matrix, and then types 'X' in the console, that calls the 'show' method, but one can still print it by calling 'print(X)'.
In order to restore the 'show' method provided by 'Matrix', call 'options("MatrixExtra.quick_show" = FALSE)'.
Usage
## S4 method for signature 'sparseMatrix'
show(object)
## S4 method for signature 'sparseVector'
show(object)
## S4 method for signature 'sparseVector'
print(x)
Arguments
object |
A sparse matrix or sparse vector. |
x |
A sparse vector (same method as in matrix, readded here to avoid naming conflicts). |
Value
The same object that was passed as input, as invisible.
Examples
library(Matrix)
library(MatrixExtra)
set.seed(1)
X <- Matrix::rsparsematrix(5, 5, .2)
set_new_matrix_behavior()
show(X)
print(X)
X
restore_old_matrix_behavior()
show(X)
print(X)
X
[Package MatrixExtra version 0.1.15 Index]