Write a R program to test whether a given vector contains a specified element.
x = c(10, 20, 30, 25, 9, 26) print("Original Vectors:") print(x) print("Test whether above vector contains 25:") print(is.element(25, x)) print("Test whether above vector contains 56:") print(is.element(56, x))
Sample Output:
[1] "Original Vectors:" [1] 10 20 30 25 9 26 [1] "Test whether above vector contains 25:" [1] TRUE [1] "Test whether above vector contains 56:" [1] FALSE
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer