How can you carry this out using built-in function as well as without it?

DWQA QuestionsCategory: R LanguageHow can you carry this out using built-in function as well as without it?
Editor Staff asked 10 months ago

Suppose that I want to know the values in c(1, 2, 6, 3, 19) that are not present in c(2, 6,
14, 3, 15). How can you carry this out using built-in function as well as without it?

1 Answers
Editor Staff answered 10 months ago

There are two methods to execute this problem –
By using setdiff() function – setdiff(c(1, 2, 6, 3, 19), c(2, 6, 14, 3, 15)) and,
Through the %in% as – c(1, 4, 5, 9, 10)[!c(1, 4, 5, 9, 10) %in% c(1, 5, 10, 11, 13)