Return Index Position of Element in Matrix Using which() Function in R (Example) | arr.ind Argument

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

mat <- matrix(1:5, # Create example matrix
ncol = 5,
nrow = 4)
mat # Print example matrix

which(mat == 4) # Apply which function with default specifications

mat_pos # Print position matrix of value 4

Follow me on Social Media:

Рекомендации по теме