Q:

Which elements in a matrix are greater than x

I have a very simple question. I have a matrix y( 1 2 3 ) and want to access elements which are greater than 1. I do not aim to count them but want to get outputs which are 2 and 3

A:

Do you mean something like this:
A = matrix( 
c(1, 2, 3),     # the data elements 
nrow=1,         # number of rows 
ncol=3,         # number of columns 
byrow = TRUE)  

A

      [,1] [,2] [,3]
 [1,]   1    2    3

Greater than 1 :
which(A > 1)

which returns:
[1] 2 3

This will return values:
 A[A>1]

