I have a dataset with two (well, actually a lot more, but they're irrelevant) numeric variables. I want to compare the value in the second variable to the (corresponding) value in the firsts value. The values in the second variable should be lower than those in the first variable. If this is not the case I want this to result in a value '1' (error) in the third variable, that indicates if the comparison is succesful or not (error: yes/no)
However, the values in both columns might differ in the number of decimals. So these should first be adjusted (each value in variable 2 should have the same number of decimals as the corresponding value in variable 1). For this I have used the function below.
Is there a convenient method for making this comparison in R?
Example of data:
var1 var2
0.06 0.060008314
0.01 0.007975829
0.03 0.034835578
0.03 0.032115433