Description Usage Arguments Value Examples
Reassign values in the non diagonal part of a matrix
similar use as its diag(x)
and diag(x) <- value
equivalent
1 | non.diagonal(x) <- value
|
x |
matrix or other R object with |
value |
scalar or vector of values to replace the non diagonal part of |
a matrix with similar dimensions as x
where the non-diagonal parts have been replaced by the value in value
1 2 3 4 5 6 7 8 9 | set.seed(42)
M <- matrix(sample(1:10,16,replace = TRUE),4,4)
M
non.diagonal(M) <- round(runif(12,0,1))
M
non.diagonal(M) <- 42
M
non.diagonal(M) <- 1:12
M
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.