triplet {spam} | R Documentation |
Transform a "spam" Format to Triplets
Description
Returns a list containing the indices and elements of a spam
object.
Usage
triplet(x, tri=FALSE)
Arguments
x |
sparse matrix of class |
tri |
Boolean indicating whether to create individual row and column indices vectors. |
Details
The elements are row (column) first if x
is a spam
object (matrix).
Value
A list with elements
indices |
a by two matrix containing the indices if
|
i , j |
vectors containing the row and column indices if |
values |
a vector containing the matrix elements. |
Author(s)
Reinhard Furrer
See Also
spam.creation
for the inverse operation and
foreign
for other transformations.
Examples
x <- diag.spam(1:4)
x[2,3] <- 5
triplet(x)
all.equal( spam( triplet(x, tri=TRUE)), x)
[Package spam version 2.10-0 Index]