coerce-methods {spam} | R Documentation

## Force a `spam` Object to Belong to a Class

### Description

These functions manage the relations that allow coercing a `spam` object to a given class.

### Methods

`signature(from = "spam", to = "matrix")`

  this is essentially equivalent to `as.matrix(object)`.

`signature(from = "spam", to = "list")`

  this is essentially equivalent to `triplet(object)`.

`signature(from = "spam", to = "vector")`

  this is essentially equivalent to `object@entries` (`structurebased=TRUE`) or `c(object)`.

`signature(from = "spam", to = "logical")`

  the entries are forced to logicals (nonzeros only in case of `structurebased=TRUE`).

`signature(from = "spam", to = "integer")`

  the entries are forced to integers (nonzeros only in case of `structurebased=TRUE`).

### Examples

    ifelse( diag.spam(2)*c(0,1), TRUE, FALSE)

[Package spam version 2.2-2 Index]