I want to compare the first row of an array with the rest of them. So I am running the following code but the results are not as expected. For example flag[2, 1] is FALSE instead of TRUE (2 > 1). Any idea what I am doing wrong ?
yy <- array(data = c(1:16), dim = c(4,4))
yy
# [,1] [,2] [,3] [,4]
#[1,] 1 5 9 13
#[2,] 2 6 10 14
#[3,] 3 7 11 15
#[4,] 4 8 12 16
flag <- (yy >= yy[1, ])
flag
# [,1] [,2] [,3] [,4]
#[1,] TRUE TRUE TRUE TRUE
#[2,] FALSE TRUE TRUE TRUE
#[3,] FALSE FALSE TRUE TRUE
#[4,] FALSE FALSE FALSE TRUE
Thank you all.