set_diag | R Documentation |
Pipe friendly wrapper to 'diag(x) <- value'
set_diag(x, value)
x |
a matrix |
value |
either a single value or a vector of length equal to the diagonal of 'x'. |
a matrix
library(dplyr)
matrix(0,3,3) %>%
set_diag(1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.