inla.as.sparse {INLA} | R Documentation

## Convert a matrix or sparse matrix into the sparse formate used by INLA

### Description

Convert a matrix or sparse matrix into the sparse format used by INLA (dgTMatrix)

### Usage

    inla.as.sparse(A, unique = TRUE, na.rm = FALSE, zeros.rm = FALSE)

    inla.as.dgTMatrix(...)

### Arguments

`A` | The matrix
`unique` | Logical. If `TRUE`, then ensure that the internal representation is unique and there are no duplicated entries. (Do not change this unless you know what you are doing.)
`na.rm` | Replace `NA`'s in the matrix with zeros.
`zeros.rm` | Remove zeros in the matrix.
`...` | The arguments. The matrix or sparse matrix, and the additonal arguments

### Value

`inla.as.sparse` and `inla.as.dgTMatrix` is the same function. The returned value is a sparse matrix in the `dgTMatrix`-format.

### Author(s)

Havard Rue hrue@r-inla.org

### Examples

     A = matrix(1:9, 3, 3)
     inla.as.sparse(A)

[Package INLA version 26.02.05 Index]