Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

How to replace values from variable A and B with NA if value of A is lower than value of B

$
0
0

How to replace values of variable-A and variable-B with NA if the variable-A value is smaller than the corresponding value in variable B. It is in R. I know that I have to use some sort of for-if-else statement, but I am lost.

Let's say I have a dataframe with 2 variables, A and B. And everytime the value of variable A is lower than the value of variable B, I want the values (from variable A and B) to be replaced with NA.


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>