I have the following matrices:
m = matrix(c(1:12), nrow=4)
p = matrix(c(2,7,11), nrow=1)
Per each column of m and p, I want to find the values in the columns of m which are less than the values in columns of p
p = 1 6 11
m = 1 5 9
2 6 10
3 7 11
4 8 12
So that I can get something like this:
ans = m[,] > p[,]
ans =
F F F
T F F
T T F
T T T
(or something similar)
I have tried m[,] > p[,] and also set p to be a vector, but neither works.
1 Answer