[R] How to check to see if a variable is within a range of another variable

Kate Ignatius kate.ignatius at gmail.com
Thu Oct 2 00:11:05 CEST 2014


Is there an easy way to check whether a variable is within  +/- 10%
range of another variable in R?

Say, if I have a variable 'A', whether its in +/- 10% range of
variable 'B' and if so, create another variable 'C' to say whether it
is or not?

Is there a function that is able to do that?

eventual outcome:
A B C
67 76 no
24 23 yes
40 45 yes
10 12 yes
70 72 yes
101 90 no
9 12 no



More information about the R-help mailing list