powered by
diag_ind(n)
diag_mat
ind <- diag_ind(5) diag_mat(seq(5))[ind]
Run the code above in your browser using DataLab