assert_one_of(3, 1:5) # Passes because 3 is in 1:5
assert_one_of("A", c("A", "B", "C")) # Passes because "A" is in the vector
try({
assert_one_of("D", c("A", "B", "C")) # Throws error because "D" is not in the vector
})
Run the code above in your browser using DataLab