I simplified the issue to the following situation:
There is a dataframe df
(which is a subsection of another where the previous four rows are just NaN):
R_shunt R_Bosch R_1 R_2 R_3 R_4 R_5 R_6 R_7 R_8
5 81317 138404 102678 135544 158359 83282 86151 90371 119277 98487
6 128501 118684 101001 102568 169562 78182 72561 85573 70014 95572
and there is another dataframe or vector or list (so far the type doesn't matter, apparently):
comp
:
[1] 52398 115826 82691 139825 126657 125659 96578 94017 81740 126819
Now I want to know which cells of df
are less than the cells of comp
:
df > comp
R_shunt R_Bosch R_1 R_2 R_3 R_4 R_5 R_6 R_7 R_8
5 TRUE TRUE FALSE TRUE TRUE TRUE TRUE FALSE TRUE TRUE
6 TRUE FALSE FALSE TRUE TRUE FALSE FALSE FALSE FALSE FALSE
which is somehow wrong. This here is a column-wise comparison, e.g. only the first column of df
shall be compared with the first column of comp
. For example, R_Bosch
in the sixth row should be TRUE
. I don't get it.
When I set up comp
like this:
comp = c(100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000)
and compare, it is correct:
> df> comp
R_shunt R_Bosch R_1 R_2 R_3 R_4 R_5 R_6 R_7 R_8
5 FALSE TRUE TRUE TRUE TRUE FALSE FALSE FALSE TRUE FALSE
6 TRUE TRUE TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE
Now, when I do it manually but use the aimed values like
comp = c(52398, 115826, 82691, 139825, 126657, 125659, 96578, 94017, 81740, 126819)
> df> comp
R_shunt R_Bosch R_1 R_2 R_3 R_4 R_5 R_6 R_7 R_8
5 TRUE TRUE FALSE TRUE TRUE TRUE TRUE FALSE TRUE TRUE
6 TRUE FALSE FALSE TRUE TRUE FALSE FALSE FALSE FALSE FALSE
it is still wrong.
I must systemically misunderstand something.