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