I want to use comparison operators between vectors and dataframes. Say, for example, I have a vector vector_test
defined in R as
vector_test = c(1, 2, 3)
and a corresponding dataframe A_test
defined as
A_test = data.frame(
x1 = c(1, 2, 3, 4, 5),
x2 = c(2, 3, 4, 5, 6),
x3 = c(3, 4, 5, 6, 7)
)
I want to use vector_test
for isolating which elements in A_test
are greater than / equal to the elements in vector_test
. I want the output to be something like
A_test >= vector_test
> TRUE TRUE .
TRUE. TRUE. .
TRUE. TRUE. .
TRUE. ... .
TRUE. ... TRUE
But instead I got
It sounds dumb, I know, but I can't figure out (a) what I'm doing wrong and (b) what comparison R is making.