Find Index Positions of Non-Zero Values in Matrix in R (Example) | Get Row & Column | which Function

preview_player
Показать описание
R code of this video:

my_mat <- matrix(c(0, 1, 2, 0, 0, 2, 1, 2, 0), # Create example matrix
ncol = 3)
my_mat # Print example matrix

mat_nonzero # Matrix of non-zero locations

Follow me on Social Media:

Рекомендации по теме
Комментарии
Автор

how about putting another column to show the value of the non-zero values?

cherymaelada