powered by
Function to add numeric to the diagonal of a matrix
add.diag(M, d)
Matrix with increased diagonal elements
Matrix with modified diagonal entries
Matrix
Vector to add to the diagonal of the matrix
A <- matrix(c(1,2,3,4), ncol=2) B <- add.diag(A, 5)
Run the code above in your browser using DataLab