Write a R program to find the elements of a given vector that are not in another given vector
- برمجة R
- 2021-09-05
- adonis77j
الأجوبة
a = c(0, 10, 10, 10, 20, 30, 40, 40, 40, 50, 60)
b = c(10, 10, 20, 30, 40, 40, 50)
print("Original vector-1:")
print(a)
print("Original vector-2:")
print(b)
print("Elements of a that are not in b:")
result = setdiff(a, b)
print(result)
Sample Output:
[1] "Original vector-1:" [1] 0 10 10 10 20 30 40 40 40 50 60 [1] "Original vector-2:" [1] 10 10 20 30 40 40 50 [1] "Elements of a that are not in b:" [1] 0 60
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
معلومات ذات صلة