diagonal | R Documentation |

Extract diagonal terms from a variety of matrix types

```
diagonal(x, indices = NULL)
## Default S3 method:
diagonal(x, indices = NULL)
```

`x` |
A square matrix |

`indices` |
specifies a subset of the diagonal using a character vector of
names, a logical vector or integer indices. The default ( |

Insists that input matrix is square. Uses the `'diagonal'`

attribute when available and has specialised handling of `ff`

,
`big.matrix`

, `dgCMatrix`

matrices. Does not check that row and
column names are identical for those matrix classes (unlike the base
`diag`

function, but always uses rownames.

a named vector containing the diagonal elements.

```
m=fill_in_sparse_score_mat(letters[1:5])
diagonal(m)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.