I am trying to create a conditional statement that checks whether certain values are all present in another vector, but I would like to modify the conditional such that there is a margin of error that satisfies some deviations from the conditional (I am trying to avoid floating points). Here is an example
x1= 2.595
x2= 4.231
x3=3.236
x= c(2.592,3.64,3.235, 5.33,4.229)
if(all(c(x1,x2,x3) %in% x)){print("pls help")}
Any ideas on how I could modify the above conditional statement to leave some leeway? So that x1,x2,x3 dont have to be exactly equal to any of the values in x for the conditional to be true?
Aucun commentaire:
Enregistrer un commentaire